-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
26 lines (22 loc) · 826 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
const gulp = require('gulp')
const clean = require('gulp-clean')
const config = require('./tools/config')
const BuildTask = require('./tools/build')
const id = require('./package.json').name || 'miniprogram-custom-component'
// build task instance
// eslint-disable-next-line no-new
new BuildTask(id, config.entry)
// clean the generated folders and files
gulp.task('clean', gulp.series(() => gulp.src(config.distPath, {read: false, allowEmpty: true}).pipe(clean()), done => {
if (config.isDev) {
return gulp.src(config.demoDist, {read: false, allowEmpty: true})
.pipe(clean())
}
return done()
}))
// watch files and build
gulp.task('watch', gulp.series(`${id}-watch`))
// build for develop
gulp.task('dev', gulp.series(`${id}-dev`))
// build for publish
gulp.task('default', gulp.series(`${id}-default`))