-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgulpfile.js
53 lines (40 loc) · 1.2 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 ts = require("gulp-typescript");
const typescript = require("typescript");
const sourcemaps = require("gulp-sourcemaps");
const del = require("del");
const tsProject = ts.createProject("./tsconfig.json", { typescript });
const inlineMap = true;
const inlineSource = false;
const outDest = "out";
const languages = [{ id: "zh-cn", folderName: "chs", transifexId: "zh-hans" }];
const cleanTask = function () {
return del(["out/**"]);
};
const compileTask = function () {
var r = tsProject.src().pipe(sourcemaps.init()).pipe(tsProject());
if (inlineMap && inlineSource) {
r = r.pipe(sourcemaps.write());
} else {
r = r.pipe(
sourcemaps.write("../out", {
// no inlined source
includeContent: inlineSource,
// Return relative source map root directories per file.
sourceRoot: "../src",
}),
);
}
return r.pipe(gulp.dest(outDest));
};
const buildTask = gulp.series(cleanTask, compileTask);
const watchTask = function () {
buildTask();
return gulp.watch(["src/**"], function (cb) {
buildTask();
cb();
});
};
gulp.task("default", buildTask);
gulp.task("build", buildTask);
gulp.task("watch", watchTask);