-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.babel.js
50 lines (39 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
'use strict';
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import {exec} from 'child_process';
const $ = gulpLoadPlugins({
pattern: ['gulp-*', 'run-sequence', 'minimist'],
scope: ['devDependencies']
});
const argv = $.minimist(process.argv.slice(2));
gulp.task('eslint', () => {
console.log('\n| Running ESLint |');
console.log('+----------------------------------------------------------+');
return gulp.src(['./src/**/*.js', './spec/**/*.js', '!node_modules/**'])
.pipe($.eslint('./.eslintrc'))
.pipe($.filelog('eslint'))
.pipe($.eslint.format())
.pipe($.eslint.failAfterError());
});
gulp.task('watch', () => {
gulp.watch(['./src/**/*.js', './spec/**/*.js'], ['eslint']);
});
gulp.task('test', cb => {
exec('npm test', (err, stdout) => {
if(err) throw new $.util.PluginError('test', err);
$.util.log('[test]', stdout.toString({
colors: true
}));
cb();
});
});
gulp.task('default', cb => {
$.runSequence('eslint', 'test', () => {
$.util.log($.util.colors.green.bold('FINISHED BUILD'));
if(argv.w){
$.runSequence('watch');
}
cb();
});
});