-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·80 lines (68 loc) · 2.06 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
var gulp = require('gulp');
var del = require('del');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var runSequence = require('run-sequence');
var $ = require('gulp-load-plugins')({lazy: true});
gulp.task('help', $.taskListing);
gulp.task('default', ['help']);
gulp.task('test', function () {
return gulp.src([
'node_modules/sinon/pkg/sinon.js',
'node_modules/sinon-stub-promise/index.js',
'node_modules/axios/dist/axios.min.js',
'node_modules/pubsub-js/src/pubsub.js',
'node_modules/q/q.js',
'node_modules/qretry/build/qretry.min.js',
'node_modules/jasmine-ajax/lib/mock-ajax.js',
'src/patience.js',
'src/patience.spec.js'])
.pipe($.karma({
configFile: 'karma.conf.js',
action: 'run'
}));
});
gulp.task('bump-patch', function () {
return gulp.src(['package.json', 'bower.json'])
.pipe($.bump())
.pipe(gulp.dest('./'));
});
gulp.task('bump-minor', function () {
return gulp.src(['package.json', 'bower.json'])
.pipe($.bump({type: 'minor'}))
.pipe(gulp.dest('./'));
});
gulp.task('bump-major', function () {
return gulp.src(['package.json', 'bower.json'])
.pipe($.bump({type: 'major'}))
.pipe(gulp.dest('./'));
});
gulp.task('clean-dist', function () {
del(['dist/*'], function (err, deletedFiles) {
if (deletedFiles && deletedFiles.length > 0)
console.error('\n Files deleted: \n', deletedFiles.join(',\n '));
});
});
gulp.task('browserify', function() {
var b = browserify({
entries: 'index.js',
debug: true
});
return b.bundle()
.pipe(source('patience.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('minify', function() {
return gulp
.src(['dist/patience.js'])
.pipe(gulp.dest('dist/'))
.pipe($.rename({
suffix: '.min'
}))
.pipe($.uglify())
.pipe(gulp.dest('dist/'));
});
gulp.task('build', function() {
runSequence('clean-dist','browserify','minify')
});