-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathver.js
44 lines (33 loc) · 1.12 KB
/
ver.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
const { readFileSync, writeFileSync } = require("fs");
const suffix = readFileSync("./suffix").toString();
writeFileSync("./suffix", "");
const date = new Date();
let month = date.getMonth() + 1;
if (date.getDate() == 1 && month == 1) {
month = 0;
}
const version =
process.env.LEAD_VER ||
`${date.getFullYear()}.${+1}.${date.getDate() == 1 ? 0 : date.getDate()}` +
(process.env.NIGHTLY == "true" ? `-nightly.${Date.now()}` : "") +
suffix;
console.log(process.env.LEAD_VER || `Created version ${version}`);
const values = [
"./Cargo.toml",
"./lead/Cargo.toml",
"./leadman/Cargo.toml",
"./lead_docs/Cargo.toml",
"./lead_docs_cli/Cargo.toml",
"./packages/core/Cargo.toml",
"./packages/std/Cargo.toml",
"./interpreter/Cargo.toml",
"./macros/Cargo.toml",
];
for (const value of values) {
const file = readFileSync(value).toString();
const parsed = file.replaceAll('"0.0.0-dev-lead-lang"', '"' + version + '"');
writeFileSync(value, parsed);
}
writeFileSync("./.version", version);
const meta = readFileSync("./leadman/src/packages/metadata.rs").toString();
writeFileSync("./lead/src/metadata.rs", meta);