-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (34 loc) · 1.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
const fs = require('fs');
const path = require('path');
const gulp = require('gulp');
const clean = require('gulp-clean');
const ts = require('gulp-typescript');
const banner = require('gulp-banner');
const pkg = require('./package.json');
const bannerComment = `/**
* @license ${pkg.name} v${pkg.version}
*
* Copyright (c) Chowa Techonlogies Co.,Ltd.(https://www.chowa.cn).
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
`;
gulp.task('clean es', () => {
if (!fs.existsSync(path.join(__dirname, 'es'))) {
return Promise.resolve();
}
return gulp.src(path.join(__dirname, 'es'), { read: false })
.pipe(clean({ force: true }));
});
gulp.task('compile typescript', () => {
const tsProject = ts.createProject('tsconfig.json', { declaration: true });
return gulp.src(path.join(__dirname, 'src/*.ts'))
.pipe(tsProject())
.pipe(banner(bannerComment))
.pipe(gulp.dest(path.join(__dirname, 'es')));
});
gulp.task('default', gulp.series(
'clean es',
'compile typescript'
));