-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
39 lines (31 loc) · 896 Bytes
/
gulpfile.babel.js
File metadata and controls
39 lines (31 loc) · 896 Bytes
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
/* eslint-disable import/no-extraneous-dependencies */
import gulp from 'gulp';
import babel from 'gulp-babel';
import del from 'del';
import { exec } from 'child_process';
import eslint from 'gulp-eslint';
const paths = {
allSrcJs: 'src/**/*.js',
allLibTests: 'lib/test/**/*.js',
gulpFile: 'gulpfile.babel.js',
libDir: 'lib',
};
gulp.task('lint', () =>
gulp.src([
paths.allSrcJs,
paths.gulpFile,
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError()));
gulp.task('clean', () => del(paths.libDir));
gulp.task('build', ['lint', 'clean'], () =>
gulp.src(paths.allSrcJs)
.pipe(babel())
.pipe(gulp.dest(paths.libDir)));
gulp.task('main', ['build'], callback =>
exec(`node ${paths.libDir}`, error => callback(error)));
gulp.task('watch', () => {
gulp.watch(paths.allSrcJs, ['lint']);
});
gulp.task('default', ['watch', 'main']);