Skip to content

Commit 0525018

Browse files
committed
chore: add Error handling
1 parent 6f235e3 commit 0525018

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

scripts/actions/github.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,34 @@ async function buildProject() {
4545
if (githubTagExists) {
4646
console.log(`Tag (git) ${version} already exists`);
4747
} else {
48-
console.log(`Git tag ${version} does not exist`);
48+
try {
49+
console.log(`Git tag ${version} does not exist`);
4950

50-
buildPath ??= await build(tempjson);
51+
buildPath ??= await build(tempjson);
5152

52-
createTag(version, sha);
53+
createTag(version, sha);
5354

54-
const changelog = generateChangelog(version);
55-
await createRelease(version, buildPath, changelog);
55+
const changelog = generateChangelog(version);
56+
await createRelease(version, buildPath, changelog);
57+
} catch (error) {
58+
console.log(error);
59+
}
5660
}
5761

5862
if (npmVerExists) {
5963
console.log(`Version (npm) ${version} already exists`);
6064
} else {
61-
console.log(`npm version ${version} does not exist`);
65+
try {
66+
console.log(`npm version ${version} does not exist`);
6267

63-
buildPath ??= await build(tempjson);
68+
buildPath ??= await build(tempjson);
6469

65-
exec(`npm publish "${buildPath}" --registry=${GITHUB_URL}`, {
66-
stdio: "inherit",
67-
});
70+
exec(`npm publish "${buildPath}" --registry=${GITHUB_URL}`, {
71+
stdio: "inherit",
72+
});
73+
} catch (error) {
74+
console.log(error);
75+
}
6876
}
6977
}
7078

scripts/utils/github.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { exec } = require("./util");
2+
const path = require("node:path");
23

34
function isPrerelease(version) {
45
return /alpha|beta|rc/i.test(version);

0 commit comments

Comments
 (0)