-
Notifications
You must be signed in to change notification settings - Fork 15
/
gulpfile.js
42 lines (36 loc) · 867 Bytes
/
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
const babel = require('gulp-babel');
const cache = require('gulp-cached');
const del = require('del');
const gulp = require('gulp');
const mocha = require('gulp-spawn-mocha');
const plumber = require('gulp-plumber');
gulp.task('clean', function (cb) {
return del([
'lib/*',
'spec/**/*.js',
], cb);
});
gulp.task('build', function () {
return gulp.src('src/**/*.js')
.pipe(cache('babel'))
.pipe(plumber())
.pipe(babel())
.pipe(gulp.dest('.'));
});
gulp.task('spec', function () {
return gulp.src('spec/**/*.js', { read: false })
.pipe(plumber())
.pipe(mocha({ bail: true }));
});
gulp.task('rebuild', gulp.series(
'clean', 'build'
));
gulp.task('watch', function (done) {
gulp.watch('src/**/*.js', gulp.series(
'build', 'spec'
));
done();
});
gulp.task('default', gulp.series(
'rebuild', 'spec', 'watch'
));