-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
45 lines (39 loc) · 1.12 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
43
44
45
const gulp = require('gulp');
const exec = require('gulp-exec');
const Server = require('karma').Server;
const targets = ['commonjs', 'es6'];
targets.forEach(
(target) => {
gulp.task(
`clear-${target}`,
() => {
return gulp
.src(`./lib/${target}/toolbox`, {allowEmpty: true})
.pipe(exec(`rm -rf <%= file.path %>`));
});
});
targets.forEach(
(target) => {
gulp.task(
`compile-${target}`,
() => {
return gulp
.src(`./lib/${target}`, {allowEmpty: true})
.pipe(exec(`npx tsc -p <%= file.path %>`));
});
});
targets.forEach(
(target) => {
gulp.task(
`build-${target}`,
gulp.series(`clear-${target}`, `compile-${target}`));
});
gulp.task('doc', () => exec(`typedoc; touch docs/.nojekyll`));
gulp.task('test', (done) => {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
const buildTasks = targets.map((target) => `build-${target}`);
gulp.task('default', gulp.parallel(...buildTasks));