Skip to content

Commit d37289d

Browse files
committed
Fix scripts
1 parent ed690fe commit d37289d

4 files changed

Lines changed: 29 additions & 20 deletions

File tree

scripts/lite.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
import { execSync } from "node:child_process";
12
import fs from "node:fs";
23
import path from "node:path";
34
import { fileURLToPath } from "node:url";
45
import packageJson from "../lib/package.json";
56
import config from "./rebrand.config.json";
67

8+
// Set up npm authentication
9+
if (process.env.NODE_AUTH_TOKEN) {
10+
execSync(
11+
`npm config set //registry.npmjs.org/:_authToken ${process.env.NODE_AUTH_TOKEN}`,
12+
);
13+
}
14+
715
const __dirname = path.dirname(fileURLToPath(import.meta.url));
816

917
const ref = packageJson.name;

scripts/manual-publish.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
2020
const BRANCH = process.env.BRANCH;
2121
const DEFAULT_BRANCH = process.env.DEFAULT_BRANCH;
2222

23-
if (!BRANCH || DEFAULT_BRANCH) {
23+
if (!BRANCH || !DEFAULT_BRANCH) {
2424
exit(1);
2525
}
2626

@@ -132,21 +132,19 @@ const reTag = isLatest
132132
const publishCmd = `cd lib && pnpm build && npm publish ${provenance} --access public${
133133
tag && ` --tag ${tag}`
134134
}`;
135-
execSync(publishCmd + reTag);
135+
try {
136+
execSync(publishCmd + reTag);
136137

137-
/** Create GitHub release */
138-
execSync(
139-
`gh release create ${NEW_VERSION} --generate-notes${
140-
isLatestRelease ? " --latest" : ""
141-
} -n "$(sed '1,/^## /d;/^## /,$d' lib/CHANGELOG.md)" --title "Release v${NEW_VERSION}"`,
142-
);
138+
/** Create GitHub release */
139+
execSync(
140+
`gh release create ${NEW_VERSION} --generate-notes${
141+
isLatestRelease ? " --latest" : ""
142+
} -n "$(sed '1,/^## /d;/^## /,$d' lib/CHANGELOG.md)" --title "Release v${NEW_VERSION}"`,
143+
);
144+
} catch {}
143145

144-
try {
145-
// Publish canonical packages
146-
execSync("tsx scripts/publish-canonical.ts");
147-
} catch {
148-
console.error("Failed to publish canonical packages");
149-
}
146+
// Publish canonical packages
147+
execSync("tsx scripts/publish-canonical.ts");
150148

151149
execSync("tsx ./scripts/lite.ts");
152150
execSync(publishCmd + reTag.replace("@", "-lite@"));

scripts/publish-canonical.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { execSync } from "node:child_process";
22

3+
// Set up npm authentication
4+
if (process.env.NODE_AUTH_TOKEN) {
5+
execSync(
6+
`npm config set //registry.npmjs.org/:_authToken ${process.env.NODE_AUTH_TOKEN}`,
7+
);
8+
}
9+
310
// Publish canonical packages
411
const canonicals: string[] = [];
512

scripts/publish.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,8 @@ try {
8282
}
8383
}
8484

85-
try {
86-
// Publish canonical packages
87-
execSync("tsx scripts/publish-canonical.ts");
88-
} catch {
89-
console.error("Failed to publish canonical packages");
90-
}
85+
// Publish canonical packages
86+
execSync("tsx scripts/publish-canonical.ts");
9187

9288
execSync("tsx ./scripts/lite.ts");
9389
execSync(`cd lib && pnpm build && npm publish ${provenance} --access public`);

0 commit comments

Comments
 (0)