forked from INCATools/obographviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
109 lines (93 loc) · 2.67 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
////
//// Usage: ./node_modules/.bin/gulp build, clean, test, etc.
////
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var bump = require('gulp-bump');
var del = require('del');
var paths = {
readme: ['./README.md'],
tests: ['tests/*.test.js', 'tests/*.tests.js'],
docable: ['lib/*.js', './README.md'],
transients:['./doc/*', '!./doc/README.org']
};
// Browser runtime environment construction.
gulp.task('build', ['patch-bump', 'doc']);
gulp.task('patch-bump', function(cb){
gulp.src('./package.json')
.pipe(bump({type: 'patch'}))
.pipe(gulp.dest('./'));
cb(null);
});
gulp.task('minor-bump', function(cb){
gulp.src('./package.json')
.pipe(bump({type: 'minor'}))
.pipe(gulp.dest('./'));
cb(null);
});
gulp.task('major-bump', function(cb){
gulp.src('./package.json')
.pipe(bump({type: 'major'}))
.pipe(gulp.dest('./'));
cb(null);
});
// Build docs directory with JSDoc.
//gulp.task('doc', ['md-to-org', 'jsdoc']);
gulp.task('doc', ['jsdoc']);
// Get rid of anything that is transient.
gulp.task('clean', function(cb) {
del(paths.transients);
cb(null);
});
// Testing with mocha/chai.
gulp.task('test', function() {
return gulp.src(paths.tests, { read: false }).pipe(mocha({
reporter: 'spec',
globals: {
// Use a different should.
should: require('chai').should()
}
}));
});
//gulp.task('release', ['build', 'publish-npm', 'git-commit', 'git-tag']);
gulp.task('release', ['build', 'publish-npm']);
// Needs to have ""
gulp.task('publish-npm', function() {
var npm = require("npm");
npm.load(function (er, npm) {
// NPM
npm.commands.publish();
});
});
gulp.task('git-commit', function(){
console.log('TODO: WORK IN PROGRESS');
// Make a note in the git repo.
var pkg = require('./package.json');
var pver = pkg.version;
gulp.src('./*')
.pipe(git.commit('Package/version tracking for go-exp/widget: ' + pver));
});
gulp.task('git-tag', function(){
console.log('TODO: WORK IN PROGRESS');
// Make a note in the git repo.
var pkg = require('./package.json');
var pver = pkg.version;
git.tag('go-exp-widget-' + pver, 'version message', function (err){
if(err) throw err;
});
});
// Rerun doc build when a file changes.
gulp.task('watch-doc', function() {
gulp.watch(paths.docable, ['doc']);
gulp.watch(paths.readme, ['doc']);
});
// Rerun doc build when a file changes.
gulp.task('watch-test', function() {
gulp.watch(paths.docable, ['test']);
gulp.watch(paths.tests, ['test']);
});
// The default task (called when you run `gulp` from cli)
//gulp.task('default', ['watch', 'scripts', 'images']);
gulp.task('default', function() {
console.log("'allo 'allo!");
});