-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
36 lines (30 loc) · 909 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
const { task, src, dest, series } = require('gulp')
const plugins = require('gulp-load-plugins')()
const del = require('del')
const pump = require('pump')
const dotgitignore = require('dotgitignore')()
const { typescript, match, terser, license, filter, zip } = plugins
const project = typescript.createProject('tsconfig.json')
task('clean', () => del('dist'))
task('build', callback => {
pump([
project.src(),
project(),
plugins.if(
file => match(file, '*.js'),
terser()
),
license('MIT', { organization: '[email protected]' }),
dest('dist')
], callback)
})
task('source', callback => {
pump([
// '**'不包含'.'开头的文件,需要补充'**/.*'
src(['**{,/.*}', '!node_modules', '!.git']),
filter(file => !dotgitignore.ignore(file.path)),
zip('source.zip'),
dest('dist')
], callback)
})
task('default', series('clean', 'build'))