forked from keystonejs/keystone-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (40 loc) · 1.11 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
var browserify = require('browserify');
var git = require('gulp-git');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var uglify = require('gulp-uglify');
/**
* Build Tasks
*/
gulp.task('build-packages', function() {
var packages = require('./admin/client/packages');
var b = browserify();
packages.forEach(function(i) { b.require(i); });
b = b.bundle().pipe(source('packages.js'));
if (process.env.NODE_ENV === 'production') {
b.pipe(streamify(uglify()));
}
return b.pipe(gulp.dest('./admin/public/js'));
});
/**
* Release Tasks
*/
gulp.task('publish:tag', function(done) {
var pkg = JSON.parse(require('fs').readFileSync('./package.json'));
var v = 'v' + pkg.version;
var message = 'Release ' + v;
git.tag(v, message, function (err) {
if (err) throw err;
git.push('origin', v, function (err) {
if (err) throw err;
done();
});
});
});
gulp.task('publish:npm', function(done) {
require('child_process')
.spawn('npm', ['publish'], { stdio: 'inherit' })
.on('close', done);
});
gulp.task('release', ['publish:tag', 'publish:npm']);