-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (47 loc) · 1.09 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
46
47
48
49
50
51
52
53
const gulp = require("gulp");
const spawn = require("child_process").spawn;
const rimraf = require("rimraf");
const tsconfig = require("./tsconfig.json");
const log = require("fancy-log");
const spawnOptions = {
shell: true,
stdio: "inherit"
};
const outputDir = tsconfig.compilerOptions.outDir;
/**
* Gulp task to run `polymer serve`.
*/
const serve = () => {
spawn("polymer", ["serve"], spawnOptions);
};
/**
* Gulp task to run `tsc --watch`.
*/
const build = () => {
spawn("tsc", ["--watch"], spawnOptions);
};
/**
* Gulp task to clean the Typescript output directory.
*/
const clean = async () => {
return new Promise((resolve, reject) => {
log("Cleaning...");
rimraf(outputDir, err => {
if (err) {
log.error(
`Error while cleaning, you may want to clean the '${outputDir}' directory manually.`,
err
);
return reject(err);
}
log("Cleaning done!");
return resolve();
});
});
};
module.exports = {
default: gulp.series(clean, gulp.parallel(build, serve)),
serve: serve,
build: build,
clean: clean
};