Skip to content

Commit cea2d85

Browse files
authored
setup script to prepare for pre-release vsix (#941)
Signed-off-by: Yan Zhang <[email protected]>
1 parent 8af1e7e commit cea2d85

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

scripts/prepare-nightly-build.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const fs = require("fs");
2+
3+
const json = JSON.parse(fs.readFileSync("./package.json").toString());
4+
const stableVersion = json.version.match(/(\d+)\.(\d+)\.(\d+)/);
5+
const major = stableVersion[1];
6+
const minor = stableVersion[2];
7+
8+
function prependZero(number) {
9+
if (number > 99) {
10+
throw "Unexpected value to prepend with zero";
11+
}
12+
return `${number < 10 ? "0" : ""}${number}`;
13+
}
14+
15+
const date = new Date();
16+
const month = date.getMonth() + 1;
17+
const day = date.getDate();
18+
const hours = date.getHours();
19+
patch = `${date.getFullYear()}${prependZero(month)}${prependZero(day)}${prependZero(hours)}`;
20+
21+
const insiderPackageJson = Object.assign(json, {
22+
version: `${major}.${minor}.${patch}`,
23+
});
24+
25+
fs.writeFileSync("./package.insiders.json", JSON.stringify(insiderPackageJson));

0 commit comments

Comments
 (0)