-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
42 lines (33 loc) · 827 Bytes
/
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
const gulp = require('gulp')
const path = require('path')
const del = require('del')
const exec = require('child_process').exec
function defaultTask(cb) {
cb();
}
gulp.task('clean', async () => {
await del(['dist/**/*'])
})
gulp.task('webpack dev', (cb) => {
return exec('npm run dev', (err, stdout, stderr) => {
console.log(stdout)
if (err) {
return err
}
cb()
})
})
gulp.task('webpack build', (cb) => {
return exec('npm run build', (err, stdout, stderr) => {
console.log(stdout)
if (err) {
return err
}
cb()
})
})
gulp.task('copyFile', () => {
return gulp.src('dist/coco-miniprogram.js').pipe(gulp.dest('tools/demo/'))
})
gulp.task("dev", gulp.series('clean', 'webpack dev', 'copyFile'))
gulp.task("build", gulp.series('clean', 'webpack build', 'copyFile'))