-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
61 lines (50 loc) · 1.26 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
51
52
53
54
55
56
57
58
59
60
61
import gulp from 'gulp'
import gulpLoadPlugins from 'gulp-load-plugins'
import _ from 'lodash'
import defaultAssets from './config/asset/default'
import testAssets from './config/asset/test'
const plugins = gulpLoadPlugins()
function lintJs() {
const all = _.union(
defaultAssets.client.Js,
defaultAssets.server.allJS,
defaultAssets.server.gulpfile
)
return gulp.src(all)
.pipe(plugins.eslint())
.pipe(plugins.eslint.format())
}
function test() {
return gulp.src(testAssets.all, {read: false})
.pipe(plugins.spawnMocha({
reporter: 'mochawesome',
istanbul: true,
timeout: 5000
}))
}
function serverRun() {
return plugins.nodemon({
script: 'app.js',
watch: _.union(
defaultAssets.server.views,
defaultAssets.server.allJS,
defaultAssets.server.gulpfile
)
})
}
function watch() {
const es = _.union(
defaultAssets.client.Js,
defaultAssets.server.allJS,
defaultAssets.server.gulpfile
)
gulp.watch(es, gulp.series(lintJs))
}
gulp.task('lint', lintJs)
gulp.task('test', test)
gulp.task('default',
gulp.series(
lintJs,
gulp.parallel(serverRun, watch)
)
)