-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
50 lines (45 loc) · 1.03 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
import gulp from 'gulp'
import watch from 'gulp-watch'
import babel from 'gulp-babel'
import eslint from 'gulp-eslint'
import nodemon from 'gulp-nodemon'
gulp.task('lint', () => {
return gulp.src(['src/**/*.js', '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
})
gulp.task('transform', () => {
return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015', 'stage-2']
}))
.pipe(gulp.dest('dist'))
})
gulp.task('watch', () => {
return gulp.src('src/**/*.js')
.pipe(watch('src/**/*.js', {
verbose: true
}))
.pipe(eslint({configFle: './.eslintrc'}))
.pipe(eslint.format())
.pipe(babel())
.pipe(gulp.dest('dist'))
})
gulp.task('dev', () => {
gulp.start('transform')
gulp.start('watch')
nodemon({
script: 'dist/app.js',
ext: 'js',
env: {'NODE_ENV': 'development'}
})
})
gulp.task('default', ['transform', 'lint'], () => {
nodemon({
script: 'dist/app.js',
ext: 'js',
watch: 'src',
tasks: ['transform']
})
})