-
Notifications
You must be signed in to change notification settings - Fork 2
/
generate-all.js
45 lines (37 loc) · 1.44 KB
/
generate-all.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
// @ts-check
const { execSync } = require("child_process");
const { join } = require("path");
const { existsSync } = require("fs");
const { versionAlreadyExists } = require('./new-release-tools');
let onlyOne = false;
function run() {
if (process.argv.length == 3 && process.argv[2] === 'onlyOne') {
onlyOne = true;
}
const cmd = "npm info react-native-windows versions --json";
console.log("Running: " + cmd);
const allVersions = JSON.parse(execSync(cmd).toString());
for (let rnwVersion of allVersions) {
const matches = /(\d+)\.(\d+).(\d+)(-[\w.-_]+)?/.exec(rnwVersion);
const isPrerelease = matches[4] !== undefined;
const isPreviewRelease = isPrerelease && matches[4].startsWith('-preview.')
const inVersionRange = matches[1] === "0" && Number.parseInt(matches[2]) >= 61;
if (inVersionRange && (!isPrerelease || isPreviewRelease)) {
if (versionAlreadyExists(rnwVersion, false /*mac*/)) {
console.log(`Already generated diff for ${rnwVersion}`);
} else {
const newReleaseCmd = `node new-release.js ${rnwVersion}`;
console.log("Running: " + newReleaseCmd);
execSync(newReleaseCmd, { stdio: "inherit" });
if (onlyOne) {
break;
}
}
}
}
if (existsSync(join(__dirname, "wt-diffs"))) {
execSync(`rmdir /S /Q wt-diffs`, { cwd: __dirname, stdio: "inherit" });
execSync(`git worktree prune`, { cwd: __dirname, stdio: "inherit" });
}
}
run();