-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
97 lines (72 loc) · 2.54 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
'use strict';
const { exec } = require("child_process");
const gulp = require("gulp");
const gulpTslint = require("gulp-tslint");
const ts = require("typescript");
const tslint = require("tslint");
const pump = require("pump");
const dirSync = require("gulp-directory-sync");
const watch = require("gulp-watch");
const batch = require("gulp-batch");
const starfallPath = require("./config/config.json").starfallPath;
const lintReport = {
emitError: false,
sort: true,
fullPath: true,
allowWarnings: true
}
gulp.task("lint", cb => {
pump([
gulp.src(["./projects/**/*.ts", "!node_modules/**", "!./projects/_*/**/*.ts"], {base: "."}),
gulpTslint({
formatter: "stylish",
configuration: "./tslint.json"
}),
gulpTslint.report(lintReport)
], cb)
});
gulp.task("lintFull", cb => {
console.log("\n\t\t=== IGNORE TYPE RESOLUTION OUTPUT ===\n<IGNORE>");
const typeProgram = tslint.Linter.createProgram("./tsconfig.json", ".");
ts.getPreEmitDiagnostics(typeProgram);
console.log("<\\IGNORE>\n\n\t\t[AeTF : TypeFall] Full type-rule supported lint-check");
pump([
// gulp.src(["./projects/**/*.ts", "!node_modules/**"], {base: "."}),
gulp.src(["projects/**/*.ts", "!projects/_*/**/*.ts", "!node_modules"], {base: "."}),
gulpTslint({
program: typeProgram,
formatter: "stylish",
configuration: "./tslint.json"
}),
gulpTslint.report(lintReport)
], cb);
});
const compile = cb => {
exec("node compiler/tfc -p ./compiler/tsconfig_c.json", (err, stdout, stderr) => {
console.log("[AeTF : TypeFall] Compiling...");
console.log(stdout);
console.log(stderr);
cb(err);
});
}
gulp.task("compile", compile);
gulp.task("sync", cb => {
pump([
gulp.src("./build/"),
dirSync("./build/", starfallPath + "/AeTF", { printSummary: true })
], cb);
});
const compileSync = gulp.series("compile", "sync");
gulp.task("compileSync", compileSync);
gulp.task("dev", cb => {
console.log("=== Starting dev-watch. Compile & sync on save ===\n");
console.log("Executing initial compileSync task...");
compileSync();
return watch("./projects/**/*.ts", batch((events, done) => {
let date = new Date();
let time = `${date.getHours()}:${date.getMinutes()}`;
console.log(`[${time}] Save detected!\n`);
compileSync(done);
}));
});
gulp.task("devDebug", gulp.series("lintFull", "dev"));