Skip to content

Commit 4ca6f60

Browse files
committed
working away on a complete developement environment
1 parent eae3471 commit 4ca6f60

File tree

7 files changed

+192
-59
lines changed

7 files changed

+192
-59
lines changed

.gitignore

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
## Do not make earlier mistakes with documentation.
2-
doc
3-
!doc/README.org
2+
# root
3+
/doc
4+
#!/doc/README.org
5+
/widget/doc
6+
!/widget/doc/README.org
47

5-
## Node modules are handled by "npm install" and out package.json
8+
## Node modules are handled by "npm install" and out of package.json
69
node_modules
710

811
## Do not commit our TAGS

widget/README.org

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* Overview
2+
3+
This widget is a trial at self-contained widgets for
4+
https://github.com/geneontology/noctua/issues/119 and
5+
https://github.com/monarch-initiative/monarch-app/issues/665
6+
.
7+
8+
* Reading list
9+
10+
On the functioning of CommonJS:
11+
12+
https://github.com/substack/browserify-handbook#require
13+
https://github.com/substack/browserify-handbook#exports

widget/dist/README.org

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Compiled distributions may go here.

widget/doc/README.org

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Generated docs will go here.

widget/gulpfile.js

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
////
2+
//// Usage: node ./node_modules/gulp/bin/gulp.js build, clean, etc.
3+
////
4+
5+
var gulp = require('gulp');
6+
var jsdoc = require("gulp-jsdoc");
7+
var mocha = require('gulp-mocha');
8+
var browserify = require('browserify');
9+
var source = require('vinyl-source-stream');
10+
var uglify = require('gulp-uglify');
11+
var rename = require("gulp-rename");
12+
var git = require("gulp-git");
13+
var bump = require("gulp-bump");
14+
var del = require('del');
15+
16+
var paths = {
17+
// tests: ['tests/*.test.js'],
18+
docable: ['lib/*.js']
19+
};
20+
21+
// Browser runtime environment construction.
22+
gulp.task('build', ['patch-bump', 'doc', 'browserify', 'compress']);
23+
24+
// Build docs directory with JSDoc.
25+
gulp.task('doc', function() {
26+
gulp.src(paths.docable)
27+
.pipe(jsdoc('./doc'));
28+
});
29+
30+
gulp.task('patch-bump', function(){
31+
gulp.src('./package.json')
32+
.pipe(bump({type: 'patch'}))
33+
.pipe(gulp.dest('./'));
34+
});
35+
36+
// See what browserify-shim is up to.
37+
process.env.BROWSERIFYSHIM_DIAGNOSTICS = 1;
38+
gulp.task('browserify', function() {
39+
return browserify()
40+
.bundle()
41+
//Pass desired output filename to vinyl-source-stream
42+
.pipe(source('./lib/widget.js'))
43+
.pipe(rename('widget.js'))
44+
// Start piping stream to tasks!
45+
.pipe(gulp.dest('./dist/'));
46+
});
47+
48+
gulp.task('compress', function() {
49+
return gulp.src('./dist/widget.js')
50+
.pipe(rename('widget.min.js'))
51+
.pipe(uglify())
52+
.pipe(gulp.dest('./dist/'));
53+
});
54+
55+
//
56+
gulp.task('clean', function(cb) {
57+
del(['./dist/*', '!./dist/README.org',
58+
'./doc/*', '!./doc/README.org']);
59+
});
60+
61+
// Testing with mocha/chai.
62+
// NOTE: I'm using chai here.
63+
gulp.task('test', function() {
64+
return gulp.src(paths.tests, { read: false }).pipe(mocha({
65+
reporter: 'spec',
66+
globals: {
67+
// Use a different should.
68+
should: require('chai').should()
69+
}
70+
}));
71+
});
72+
73+
// The default task (called when you run `gulp` from cli)
74+
//gulp.task('default', ['watch', 'scripts', 'images']);
75+
gulp.task('default', function() {
76+
console.log("'allo 'allo!");
77+
});

widget/lib/widget.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Experimental widget to demonstrate the different parts of a
3+
* npm/gulp-based build pipeline.
4+
*
5+
* The widget itself does nothing of import.
6+
*
7+
* @module go-exp-widget
8+
*/
9+
10+
// Setup the widget's environment.
11+
var us = require('underscore');
12+
var jQuery = require('jquery');
13+
14+
/**
15+
* Object class for our little widget.
16+
*
17+
* @param {String} element_id; must be resolvable by jQuery.
18+
*/
19+
//module.exports = function(element_id){
20+
21+
var anchor = this;
22+
23+
/**
24+
* Displays the given string (or strings) in the constructor's element.
25+
*
26+
* @param {String} strs or list of str
27+
*/
28+
anchor.helter = function(strs){
29+
jQuery(element_id).empty();
30+
31+
if( ! us.isArray(strs) ){ strs = [strs]; }
32+
33+
us.each(strs, function(s){
34+
jQuery(element_id).append(s);
35+
});
36+
};
37+
38+
/**
39+
* Displays the given string (or strings) in the console.
40+
*
41+
* @param {String} strs list of str
42+
*/
43+
anchor.skelter = function(strs){
44+
45+
if( ! us.isArray(strs) ){ strs = [strs]; }
46+
47+
us.each(strs, function(s){
48+
console.log('From widget (skelter): "' + s + '"');
49+
});
50+
};
51+
//};

widget/package.json

+43-56
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,66 @@
11
{
2-
"name": "noctua",
3-
"version": "0.0.9",
4-
"description": "Experimental annotation editor for the Gene Ontology.",
2+
"name": "go-exp-widget",
3+
"version": "0.0.10",
4+
"description": "Experimental test widget for the Gene Ontology.",
55
"keywords": [
6-
"OpenShift",
7-
"Heroku",
8-
"Node.js",
9-
"application",
10-
"gene ontology",
11-
"GO",
12-
"amigo",
13-
"bbop",
14-
"bbopx",
15-
"pup-tent",
16-
"noctua",
17-
"barista"
6+
"Node.js",
7+
"application",
8+
"gene ontology",
9+
"GO",
10+
"amigo",
11+
"bbop",
12+
"bbopx",
13+
"pup-tent"
1814
],
1915
"author": {
20-
"name": "SJC",
21-
"email": "sjcarbon@lbl.gov",
22-
"url": "http://berkeleybop.org/"
16+
"name": "SJC",
17+
"email": "sjcarbon@lbl.gov",
18+
"url": "http://berkeleybop.org/"
2319
},
2420
"homepage": "http://berkeleybop.org/",
2521
"repository": {
26-
"type": "git",
27-
"url": "https://github.com/geneontology/noctua"
22+
"type": "git",
23+
"url": "https://github.com/geneontology/go-exp"
2824
},
2925
"engines": {
30-
"node": ">= 0.12.2",
31-
"npm": ">= 2.7.4"
26+
"node": ">= 0.12.2",
27+
"npm": ">= 2.7.4"
3228
},
3329
"dependencies": {
34-
"amigo2": "^2.3.0",
35-
"aws-sdk": "2.0.4",
36-
"bbop": "^2.3.0",
37-
"bbopx": "^0.9.23",
38-
"cors": "2.4.1",
39-
"bootstrap": "3.3.4",
40-
"express-persona": "0.1.2",
41-
"express": "3.4.6",
42-
"http-proxy": "1.1.4",
43-
"jquery": "1.9.1",
44-
"minimist": "0.2.0",
45-
"mustache": "2.0.0",
46-
"pup-tent": "0.9.6",
47-
"socket.io": "0.9.16",
48-
"underscore": "1.8.3"
30+
"jquery": "2.1.4",
31+
"underscore": "1.8.3"
4932
},
5033
"devDependencies": {
51-
"browserify-shim": "^3.8.6",
52-
"browserify": "^10.1.3",
53-
"chai": "^2.3.0",
54-
"gulp": "^3.8.11",
55-
"gulp-jsdoc": "^0.1.4",
56-
"gulp-mocha": "^2.0.1",
57-
"gulp-uglify": "^1.2.0",
58-
"vinyl-source-stream": "1.1.0",
59-
"watchify": "^3.2.1"
34+
"browserify-shim": "^3.8.6",
35+
"browserify": "^10.1.3",
36+
"chai": "^2.3.0",
37+
"del": "^1.1.1",
38+
"express": "3.4.6",
39+
"gulp": "^3.8.11",
40+
"gulp-bump": "^0.3.0",
41+
"gulp-git": "^1.2.3",
42+
"gulp-jsdoc": "^0.1.4",
43+
"gulp-mocha": "^2.0.1",
44+
"gulp-rename": "^1.2.2",
45+
"gulp-uglify": "^1.2.0",
46+
"pup-tent": "0.9.6",
47+
"vinyl-source-stream": "1.1.0",
48+
"watchify": "^3.2.1"
6049
},
6150
"browserify": {
62-
"transform": [ "browserify-shim" ]
51+
"transform": [
52+
"browserify-shim"
53+
]
6354
},
6455
"browser": {
65-
"jquery": "./node_modules/jquery/jquery.js",
66-
"bootstrap": "./node_modules/bootstrap/dist/js/bootstrap.js",
67-
"jquery-ui": "./external_js/jquery-ui-1.10.3.custom.min.js",
68-
"jsplumb": "./external_js/jquery.jsPlumb-1.5.5.js",
69-
"tablesorter": "./external_js/jquery.tablesorter.min.js"
56+
"jquery": "./node_modules/jquery/jquery.js"
7057
},
7158
"browserify-shim": {
72-
"jquery": { "exports": "global:jQuery" },
73-
"jquery-ui": { "depends": ["jquery"] },
74-
"jsplumb": { "exports": "global:jsPlumb"}
59+
"jquery": {
60+
"exports": "jquery"
61+
}
7562
},
7663
"bundleDependencies": [],
7764
"private": false,
78-
"main": "noctua.js"
65+
"main": "lib/widget.js"
7966
}

0 commit comments

Comments
 (0)