forked from microsoft/node-pty
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpublish.js
More file actions
39 lines (33 loc) · 977 Bytes
/
publish.js
File metadata and controls
39 lines (33 loc) · 977 Bytes
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
import childProcess from "node:child_process";
import fs from "node:fs";
import path from "node:path";
const [, , topTag, ...restArgs] = process.argv;
if (topTag === undefined) {
console.error(
"You must pass the wanted tag name for the top npm package as the only argument."
);
process.exit(1);
}
if (restArgs.length !== 0) {
console.error(`Expected exactly one argument, but got: ${restArgs.length}`);
process.exit(1);
}
const VARIANTS = fs.readdirSync(
path.join(import.meta.dirname, "node_modules", "node-pty", "prebuilds")
);
for (const dir of [...VARIANTS, "top"]) {
console.info();
console.info(dir);
const tag = dir === "top" ? topTag : "latest";
const publishResult = childProcess.spawnSync(
"npm",
["publish", "--access=public", `--tag=${tag}`],
{
cwd: path.join(import.meta.dirname, "packages", dir),
stdio: "inherit",
}
);
if (publishResult.status !== 0) {
process.exit(publishResult.status);
}
}