forked from IgniteUI/igniteui-angular-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (42 loc) · 1.73 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
const gulp = require("gulp");
const fs = require("fs");
const tsNode = require('ts-node').register({
transpileOnly: true,
ignore: [/\/node_modules\/(?!igniteui-angular)/],
compilerOptions: {
module: "commonjs",
allowJs: true
}
});
// Workaround for exception with Excel samples running product code during generate-live-editing task.
navigator = { language: "en-US" };
function requireFile(path) {
delete require.cache[require.resolve(path)];
return require(path);
}
gulp.task("generate-live-editing", (done) => {
requireFile("./live-editing/LiveEditingManager.ts");
done();
});
gulp.task("overwrite-package-json", (done) => {
const packagesPaths = ["./node_modules/igniteui-angular-charts/package.json", "./node_modules/igniteui-angular-core/package.json", "./node_modules/igniteui-angular-excel/package.json", "./node_modules/igniteui-angular-gauges/package.json", "./node_modules/igniteui-angular-spreadsheet/package.json"];
packagesPaths.forEach((packagePath) => {
const package = require(packagePath);
fs.writeFileSync(packagePath, JSON.stringify(package));
});
done();
});
gulp.task("watch-live-editing", gulp.series("generate-live-editing", () => {
gulp.watch(["./src/**/*.*", "!./src/assets/**", "./live-editing/**/*.*", "package.json"], function () {
Object.keys(require.cache).forEach(function (key) {
if (key.indexOf("node_modules") === -1) {
delete require.cache[key];
}
});
gulp.start("generate-live-editing");
});
}));
gulp.task("sass-js-compile-check", async() => {
var checker = requireFile("./live-editing/services/SassJsCompileChecker.ts");
await checker.sassJsCompileChecker.run();
});