forked from wowserhq/wowser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.babel.js
54 lines (46 loc) · 1.1 KB
/
gulpfile.babel.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
import Config from 'configstore';
import babel from 'gulp-babel';
import cache from 'gulp-cached';
import del from 'del';
import gulp from 'gulp';
import mocha from 'gulp-mocha';
import pkg from './package.json';
import plumber from 'gulp-plumber';
const config = {
db: new Config(pkg.name),
scripts: 'src/**/*.js',
specs: 'spec/**/*.js'
};
gulp.task('reset', function(done) {
config.db.clear();
process.stdout.write(`\n> Settings deleted from ${config.db.path}\n\n`);
done();
});
gulp.task('clean', function(cb) {
del([
'lib/*',
'spec/*'
], cb);
});
gulp.task('scripts', function() {
return gulp.src(config.scripts)
.pipe(cache('babel'))
.pipe(plumber())
.pipe(babel())
.pipe(gulp.dest('.'));
});
gulp.task('spec', function() {
return gulp.src(config.specs, { read: false })
.pipe(plumber())
.pipe(mocha());
});
gulp.task('rebuild', gulp.series(
'clean', 'scripts'
));
gulp.task('watch', function(done) {
gulp.watch(config.scripts, gulp.series('scripts', 'spec'));
done();
});
gulp.task('default', gulp.series(
'rebuild', 'spec', 'watch'
));