-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
99 lines (85 loc) · 2.4 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
98
99
/* Uncomment the following to diagnose startup performance. */
// let requireCount = 0;
// const Module = require("module");
// const oldRequire = Module.prototype.require;
// Module.prototype.require = function(...args) {
// requireCount++;
// return oldRequire.apply(this, args);
// };
// console.time("startup");
// modify the way `path` outputs
const path = require("path");
const rel = path.relative;
path.relative = function(from, to) {
return rel(from, to).replace(/\\/g, "/");
};
// Load all dependencies
const gulp = require("gulp");
const seriesIf = require("./gulp/utils/seriesIf");
const { exec } = require("child_process");
require("./gulp/tasks/ftp.js");
require("./gulp/tasks/html.js");
require("./gulp/tasks/locale.js");
require("./gulp/tasks/static.js");
require("./gulp/tasks/tool.js");
// Run all builds
gulp.task("build", gulp.parallel(
"static",
"donate",
"html"
));
gulp.task("rsbuild", cb => exec("pnpm rsbuild build", cb));
gulp.task("buildDist", gulp.series(
gulp.parallel("build", "version"),
"rsbuild"
));
gulp.task("deployDev", gulp.series(
"buildDist",
"uploadDev",
"cleanDev"
));
gulp.task("deployQa", gulp.series(
"buildDist",
"uploadQa",
"cleanQa"
));
gulp.task("deployDQ", gulp.series(
"buildDist",
gulp.parallel(
gulp.series("uploadDev", "cleanDev"),
gulp.series("uploadQa", "cleanQa")
)
));
const deployMsg = `Before releasing, please check the following steps:
1. Check if there's unresolved fatal error report.
2. Consider updating dependencies.
3. Update the version number in package.json, and add update logs.
4. Edit README.md if needed.
5. Add GA tracking to new functionalities.
6. Add relevant tests, and make sure that new codes are covered.
Are you sure you want to deploy?"`;
gulp.task("deployPub", () => seriesIf(
async () => {
const inquirer = (await import("inquirer")).default;
const answers = await inquirer.prompt([{
type: "confirm",
message: deployMsg,
name: "ok",
default: false,
}]);
return answers.ok;
},
"buildDist",
"uploadPub",
"cleanPubInternal_"
));
// Clear all built files
gulp.task("clean", async () => {
const del = (await import("del")).deleteAsync;
del("build");
});
// The default build. It will build to the point that it can be run locally.
// Press F5 in VS Code will execute this task by default.
gulp.task("default", gulp.series("build"));
// console.log("Require count", requireCount);
// console.timeEnd("startup");