-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulp.js
47 lines (40 loc) · 913 Bytes
/
gulp.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 'babel-polyfill'
import gulp from 'gulp'
import del from 'del'
import babel from 'gulp-babel'
import eslint from 'gulp-eslint'
import nodemon from 'gulp-nodemon'
const dirs = {
jsPath: 'lib/**/*.js',
dest: 'build'
}
gulp.task('default', ['watch'], () => {
nodemon({
script: 'build/index.js',
ext: 'js',
env: {'NODE_ENV': 'development'}
})
})
gulp.task('clean', () => {
return del(['build/**/*'])
})
gulp.task('build', ['lint'], () => {
return gulp.src(dirs.jsPath)
.pipe(babel())
.pipe(gulp.dest('build'))
})
gulp.task('serve', ['lint', 'build'], () => {
nodemon({
script: 'build/index.js',
env: {'NODE_ENV': 'production'}
})
})
gulp.task('lint', () => {
return gulp.src(dirs.jsPath)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
})
gulp.task('watch', ['build'], () => {
return gulp.watch(dirs.jsPath, ['build'])
})