-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
38 lines (33 loc) · 908 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
const gulp = require('gulp')
const babel = require('gulp-babel')
const ts = require('gulp-typescript')
const del = require('del')
gulp.task('clean', async () => {
await del('lib/**')
await del('es/**')
await del('dist/**')
})
gulp.task('es', () => {
const tsProject = ts.createProject('tsconfig.json', {
module: 'ESNext'
})
return tsProject.src().pipe(tsProject()).pipe(babel()).pipe(gulp.dest('es/'))
})
gulp.task('cjs', () => {
return gulp
.src(['./es/**/*.js'])
.pipe(
babel({
configFile: '../../.babelrc'
})
)
.pipe(gulp.dest('lib/'))
})
gulp.task('declaration', () => {
const tsProject = ts.createProject('tsconfig.json', {
declaration: true,
emitDeclarationOnly: true
})
return tsProject.src().pipe(tsProject()).pipe(gulp.dest('es/')).pipe(gulp.dest('lib/'))
})
exports.default = gulp.series('clean', 'es', 'cjs', 'declaration')