Skip to content

Commit 20b2bcd

Browse files
committed
fix(monorepo): Resolve issue with checking results in scripts tools
1 parent 3522888 commit 20b2bcd

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

tools/scripts/src/bootstrap.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ try {
4141
// echo`${data}`;
4242
// });
4343
// const result = await proc;
44-
// if (!result.ok) {
44+
// if (result.exitCode !== 0) {
4545
// throw new Error(
4646
// `An error occurred while resetting the Nx daemon process: \n\n${result.message}\n`
4747
// );
4848
// }
4949

50-
echo`${chalk.green("Completed monorepo bootstrapping successfully!")}`;
50+
echo`${chalk.green("Completed monorepo bootstrapping successfully!")}`;
5151
} catch (error) {
5252
echo`${chalk.red(
5353
error?.message

tools/scripts/src/build.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ try {
4040
echo`${data}`;
4141
});
4242
let result = await proc;
43-
if (!result.ok) {
43+
if (result.exitCode !== 0) {
4444
throw new Error(
4545
`An error occurred while bootstrapping the monorepo: \n\n${
4646
result.message
@@ -56,7 +56,7 @@ try {
5656
echo`${data}`;
5757
});
5858
result = await proc;
59-
if (!result.ok) {
59+
if (result.exitCode !== 0) {
6060
throw new Error(
6161
`An error occurred while building the monorepo in ${
6262
configuration
@@ -65,7 +65,7 @@ try {
6565
}
6666

6767
echo`${chalk.green(
68-
`Successfully built the monorepo in ${configuration} mode!`
68+
`Successfully built the monorepo in ${configuration} mode!`
6969
)}`;
7070
} catch (error) {
7171
echo`${chalk.red(error?.message ? error.message : "A failure occurred while building the monorepo")}`;

tools/scripts/src/format.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ try {
3535
echo`${data}`;
3636
});
3737
let result = await proc;
38-
if (!result.ok) {
38+
if (result.exitCode !== 0) {
3939
throw new Error(
4040
`An error occurred while formatting the workspace's README file: \n\n${result.message}\n`
4141
);
@@ -49,7 +49,7 @@ try {
4949
echo`${data}`;
5050
});
5151
result = await proc;
52-
if (!result.ok) {
52+
if (result.exitCode !== 0) {
5353
throw new Error(
5454
`An error occurred while formatting the monorepo: \n\n${result.message}\n`
5555
);
@@ -63,13 +63,13 @@ try {
6363
echo`${data}`;
6464
});
6565
result = await proc;
66-
if (!result.ok) {
66+
if (result.exitCode !== 0) {
6767
throw new Error(
6868
`An error occurred while running \`nx format:write\` on the monorepo: \n\n${result.message}\n`
6969
);
7070
}
7171

72-
echo`${chalk.green("Successfully formatted the monorepo's files")}`;
72+
echo`${chalk.green("Successfully formatted the monorepo's files")}`;
7373
} catch (error) {
7474
echo`${chalk.red(error?.message ? error.message : "A failure occurred while formatting the monorepo")}`;
7575

tools/scripts/src/lint.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
echo`${data}`;
3131
});
3232
let result = await proc;
33-
if (!result.ok) {
33+
if (result.exitCode !== 0) {
3434
throw new Error(
3535
`An error occurred while linting the monorepo: \n\n${result.message}\n`
3636
);
@@ -43,13 +43,13 @@ try {
4343
echo`${data}`;
4444
});
4545
result = await proc;
46-
if (!result.ok) {
46+
if (result.exitCode !== 0) {
4747
throw new Error(
4848
`An error occurred while running \`storm-lint\` on the monorepo: \n\n${result.message}\n`
4949
);
5050
}
5151

52-
echo`${chalk.green("Successfully linted the monorepo's files")}`;
52+
echo`${chalk.green("Successfully linted the monorepo's files")}`;
5353
} catch (error) {
5454
echo`${chalk.red(error?.message ? error.message : "A failure occurred while linting the monorepo")}`;
5555

tools/scripts/src/nuke.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
// echo`${data}`;
3131
// });
3232
// let result = await proc;
33-
// if (!result.ok) {
33+
// if (result.exitCode !== 0) {
3434
// throw new Error(
3535
// `An error occurred while cleaning the monorepo projects: \n\n${result.message}\n`
3636
// );
@@ -41,7 +41,7 @@ try {
4141
echo`${data}`;
4242
});
4343
let result = await proc;
44-
if (!result.ok) {
44+
if (result.exitCode !== 0) {
4545
throw new Error(
4646
`An error occurred while clearing Nx cache: \n\n${result.message}\n`
4747
);
@@ -54,7 +54,7 @@ try {
5454
echo`${data}`;
5555
});
5656
result = await proc;
57-
if (!result.ok) {
57+
if (result.exitCode !== 0) {
5858
throw new Error(
5959
`An error occurred while removing cache directories: \n\n${result.message}\n`
6060
);
@@ -65,7 +65,7 @@ try {
6565
echo`${data}`;
6666
});
6767
result = await proc;
68-
if (!result.ok) {
68+
if (result.exitCode !== 0) {
6969
throw new Error(
7070
`An error occurred while removing node modules and build directories from the monorepo's projects: \n\n${result.message}\n`
7171
);
@@ -76,7 +76,7 @@ try {
7676
echo`${data}`;
7777
});
7878
result = await proc;
79-
if (!result.ok) {
79+
if (result.exitCode !== 0) {
8080
throw new Error(
8181
`An error occurred while removing node modules and build directories from the monorepo's projects: \n\n${result.message}\n`
8282
);
@@ -87,13 +87,13 @@ try {
8787
echo`${data}`;
8888
});
8989
result = await proc;
90-
if (!result.ok) {
90+
if (result.exitCode !== 0) {
9191
throw new Error(
9292
`An error occurred while removing node modules and build directories from the monorepo's projects: \n\n${result.message}\n`
9393
);
9494
}
9595

96-
echo`${chalk.green("Successfully nuked the cache, node modules, and build folders \n\n")}`;
96+
echo`${chalk.green("Successfully nuked the cache, node modules, and build folders \n\n")}`;
9797
} catch (error) {
9898
echo`${chalk.red(error?.message ? error.message : "A failure occurred while nuking the monorepo")}`;
9999
}

tools/scripts/src/release.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ try {
4141
echo`${data}`;
4242
});
4343
let result = await proc;
44-
if (!result.ok) {
44+
if (result.exitCode !== 0) {
4545
throw new Error(
4646
`An error occurred while building workspace packages: \n\n${result.message}\n`
4747
);
@@ -54,13 +54,13 @@ try {
5454
echo`${data}`;
5555
});
5656
result = await proc;
57-
if (!result.ok) {
57+
if (result.exitCode !== 0) {
5858
throw new Error(
5959
`An error occurred while releasing workspace packages: \n\n${result.message}\n`
6060
);
6161
}
6262

63-
echo`${chalk.green("Successfully released workspace packages")}`;
63+
echo`${chalk.green("Successfully released workspace packages")}`;
6464
} catch (error) {
6565
echo`${chalk.red(error?.message ? error.message : "A failure occurred while releasing workspace packages")}`;
6666

tools/scripts/src/update-storm.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
);
3131
proc.stdout.on("data", data => echo`${data}`);
3232
let result = await proc;
33-
if (!result.ok) {
33+
if (result.exitCode !== 0) {
3434
throw new Error(
3535
`An error occurred while updating "@storm-software/*" packages:\n\n${result.message}\n`
3636
);
@@ -43,7 +43,7 @@ try {
4343
);
4444
proc.stdout.on("data", data => echo`${data}`);
4545
result = await proc;
46-
if (!result.ok) {
46+
if (result.exitCode !== 0) {
4747
throw new Error(
4848
`An error occurred while updating "@stryke/*" packages:\n\n${result.message}\n`
4949
);
@@ -53,7 +53,7 @@ try {
5353
proc = $`pnpm dedupe`.timeout(`${8 * 60}s`);
5454
proc.stdout.on("data", data => echo`${data}`);
5555
result = await proc;
56-
if (!result.ok) {
56+
if (result.exitCode !== 0) {
5757
throw new Error(
5858
`An error occurred while deduplicating workspace dependencies:\n\n${result.message}\n`
5959
);
@@ -63,13 +63,13 @@ try {
6363
proc = $`pnpm update --recursive --workspace`.timeout(`${8 * 60}s`);
6464
proc.stdout.on("data", data => echo`${data}`);
6565
result = await proc;
66-
if (!result.ok) {
66+
if (result.exitCode !== 0) {
6767
throw new Error(
6868
`An error occurred while refreshing workspace links:\n\n${result.message}\n`
6969
);
7070
}
7171

72-
echo`${chalk.green(" Successfully updated Storm Software package dependencies and re-linked workspace packages")}\n\n`;
72+
echo`${chalk.green(" Successfully updated Storm Software package dependencies and re-linked workspace packages")}\n\n`;
7373
} catch (error) {
7474
echo`${chalk.red(
7575
error?.message ??

0 commit comments

Comments
 (0)