-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgulpfile.js
42 lines (37 loc) · 1 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
const gulp = require('gulp')
const del = require('del')
const rollupConfig = require('./rollup.config')
const rollup = require('rollup')
const ts = require('gulp-typescript')
gulp.task('clean-lib', async function() {
await del('lib/**')
})
gulp.task('copy-files', function() {
return gulp
.src(['package.json', 'README.md', 'LICENSE'])
.pipe(gulp.dest('lib/'))
})
gulp.task('ts', function() {
const tsProject = ts.createProject('tsconfig.json')
return tsProject.src()
.pipe(tsProject())
.pipe(gulp.dest('lib'))
})
gulp.task('rollup', gulp.series(
function() {
const tsProject = ts.createProject('tsconfig.json', {
module: 'esnext',
})
return tsProject.src()
.pipe(tsProject())
.pipe(gulp.dest('lib/es'))
},
async function() {
const bundle = await rollup.rollup(rollupConfig)
return await bundle.write(rollupConfig.output)
},
async function() {
await del('lib/es')
}
))
gulp.task('build', gulp.series('clean-lib', 'rollup', 'ts', 'copy-files'))