-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
51 lines (42 loc) · 1.07 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
// eslint-disable-next-line import/no-unassigned-import
require('./config/env');
const del = require('del');
const gulpRemark = require('gulp-remark');
const gulpXo = require('gulp-xo');
const lr = require('gulp-livereload');
const { lastRun, watch, series, parallel, src, dest } = require('gulp');
const config = require('./config');
// const PROD = config.env === 'production';
// const DEV = config.env === 'development';
const TEST = config.env === 'test';
function xo() {
return src('.', { since: lastRun(xo) })
.pipe(gulpXo({ quiet: true, fix: true }))
.pipe(gulpXo.format())
.pipe(gulpXo.failAfterError());
}
function remark() {
return src('.', { since: lastRun(remark) })
.pipe(
gulpRemark({
quiet: true,
frail: true
})
)
.pipe(dest('.'));
}
function clean() {
return del([config.buildBase]);
}
const build = series(clean, parallel(...(TEST ? [] : [xo, remark])));
module.exports = {
clean,
build,
watch() {
lr.listen(config.livereload);
watch(['**/*.js'], xo);
},
xo,
remark
};
exports.default = build;