-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathpublish.js
35 lines (30 loc) · 1.06 KB
/
publish.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
const { readFileSync, writeFileSync } = require("fs");
const configPath = "build-templates/web-mobile/config.json";
const config = JSON.parse(readFileSync(configPath, { encoding: "utf-8" }));
const version = process.argv[2];
if (version) {
config.version = version;
writeFileSync(configPath, JSON.stringify(config, null, 4));
} else {
console.log("No version specified, skip updating version");
}
console.log("Config:", config);
const buildNumberFile = "assets/Script/General/BuildNumber.ts";
const buildNumber = readFileSync(buildNumberFile, { encoding: "utf-8" })
.replace('export const BUILD_NUMBER = "', "")
.replace('";', "");
const newBuildNumber = parseInt(buildNumber, 10) + 1;
console.log("Build Number:", newBuildNumber);
writeFileSync(
buildNumberFile,
`export const BUILD_NUMBER = "${newBuildNumber}";`
);
eval(
readFileSync("assets/Script/CoreGame/Changelog.ts", {
encoding: "utf-8",
}).replace("export const CHANGELOG", "var changelog")
);
writeFileSync(
"build-templates/web-mobile/changelog.json",
JSON.stringify(changelog, null, 4)
);