-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
47 lines (39 loc) · 1006 Bytes
/
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
import gulp from 'gulp';
import babel from 'gulp-babel';
import mocha from 'gulp-mocha';
import eslint from 'gulp-eslint';
import rimraf from 'gulp-rimraf';
import runSequence from 'run-sequence';
var config = {
paths: {
js: {
src: 'src/**/*.js',
dist: 'dist/'
}
}
};
gulp.task('clean', () =>
gulp.src([config.paths.js.dist])
.pipe(rimraf({ force: true }))
);
gulp.task('babel', ['babel-src']);
gulp.task('babel-src', ['lint-src'], () =>
gulp.src(config.paths.js.src)
.pipe(babel())
.pipe(gulp.dest(config.paths.js.dist))
);
gulp.task('lint-src', () =>
gulp.src(config.paths.js.src)
.pipe(eslint())
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(eslint.failAfterError())
);
gulp.task('watch', () => {
gulp.watch(config.paths.js.src, ['babel-src']);
});
// Default Task
gulp.task('default', () =>
runSequence('clean', ['babel'])
);