This repository has been archived by the owner on Jan 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpFile.js
61 lines (49 loc) · 1.61 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
var gulp = require('gulp'),
git = require('gulp-git'),
bump = require('gulp-bump'),
tag_version = require('gulp-tag-version'),
nodemon = require('gulp-nodemon'),
runSequence = require('run-sequence').use(gulp),
spawn = require('child_process').spawn;
var srcDir = './src';
var yasguiDir = './node_modules/yasgui';
function inc(importance) {
// get all the files to bump version in
return gulp.src(['./package.json', './bower.json'])
// bump the version number in those files
.pipe(bump({type: importance}))
// save it back to filesystem
.pipe(gulp.dest('./'));
}
gulp.task('publish', function (done) {
spawn('npm', ['publish'], { stdio: 'inherit' }).on('close', done);
});
gulp.task('push', function (done) {
git.push('origin', 'master', {args: " --tags"}, function (err) {
if (err) throw err;
});
});
gulp.task('tag', function() {
return gulp.src(['./package.json'])
.pipe(git.commit('version bump'))
.pipe(tag_version());
});
gulp.task('bumpPatch', function() { return inc('patch'); })
gulp.task('bumpMinor', function() { return inc('minor'); })
gulp.task('bumpMajor', function() { return inc('major'); })
gulp.task('patch', function() {
runSequence('bumpPatch', 'tag', 'publish', 'push');
});
gulp.task('minor', function() {
runSequence('bumpMinor', 'tag', 'publish', 'push');
});
gulp.task('major', function() {
runSequence('bumpMajor', 'tag', 'publish', 'push');
});
gulp.task('serve', function() {
process.env.yasguiDev = 1;
nodemon({ script: './src/index.js', watch: './src' })
});
gulp.task('default', function() {
require('./src/index');
});