-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
64 lines (56 loc) · 1.43 KB
/
gulpfile.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
62
63
64
import gulp from 'gulp'
import gulplog from 'gulplog'
import gulpJsonlint from 'gulp-jsonlint'
import gulpStandard from 'gulp-standard'
import gulpWatch from 'gulp-watch'
const paths = {
json: [
'*.json',
'data/**/*.json',
'examples/**/*.json',
'fixtures/**/*.json'
],
scripts: ['*.js', 'examples/**/*.js', 'lib/**/*.js', 'test/**/*.js']
}
export const standard = () =>
gulp
.src(paths.scripts)
.pipe(gulpStandard())
.pipe(
gulpStandard.reporter('default', {
breakOnError: true
})
)
export const jsonlint = () =>
gulp
.src(paths.json)
.pipe(gulpJsonlint())
.pipe(gulpJsonlint.failAfterError())
.pipe(gulpJsonlint.reporter())
export const watchScripts = () =>
gulp
.src(paths.scripts)
.pipe(
gulpWatch(paths.scripts, (vinyl) => {
if (vinyl.event === 'change') {
gulplog.info(`Linted ${vinyl.relative}`)
}
})
)
.pipe(gulpStandard())
.pipe(gulpStandard.reporter('default', {}))
export const watchJson = () =>
gulp
.src(paths.json)
.pipe(
gulpWatch(paths.json, (vinyl) => {
if (vinyl.event === 'change') {
gulplog.info(`Linted ${vinyl.relative}`)
}
})
)
.pipe(gulpJsonlint())
.pipe(gulpJsonlint.reporter())
export const lint = gulp.parallel(jsonlint, standard)
export const watch = gulp.parallel(watchJson, watchScripts)
export default gulp.series(lint, watch)