-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
55 lines (47 loc) · 1.32 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
var
gulp = require('gulp'),
gutil = require('gulp-util'),
browserify = require('gulp-browserify'),
rename = require('gulp-rename'),
gbump = require('gulp-bump'),
jasmine = require('jasmine-runner-node');
gulp.task('watch', function() {
gulp.watch('./lib/**/*', ['build:browser']);
});
var bump = function(type) {
gulp.src(['./bower.json', './package.json'])
.pipe(gbump({type: type}))
.pipe(gulp.dest('./'));
};
gulp.task('bump:major', function() { bump('major'); });
gulp.task('bump:minor', function() { bump('minor'); });
gulp.task('bump:patch', function() { bump('patch'); });
gulp.task('build:browser', function() {
gulp.src('./lib/index.js')
.pipe(browserify({
standalone: 'monorouter',
transform: ['browserify-shim']
}))
.pipe(rename('monorouter.js'))
.pipe(gulp.dest('./standalone/'));
});
gulp.task('build:tests', function() {
gulp.src('./lib/**/__tests__/*.js')
.pipe(browserify({
insertGlobals : true,
debug : !gulp.env.production
}))
.pipe(gulp.dest('./.tests-built/'));
});
gulp.task('watch:tests', function() {
gulp.watch('./lib/**/*', ['build:tests']);
});
gulp.task('test', ['build:tests'], function() {
jasmine.start({
port: 8888,
files: {
spec: './.tests-built/**/*.js'
}
});
});
gulp.task('build', ['build:browser']);