Skip to content

Commit 356775d

Browse files
committed
adjust prepack.ts to exit with error when package-specific prepack.ts errors
1 parent 0a56148 commit 356775d

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

scripts/prepack.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ async function runPackagePrepack(packagePrepackPath: string): Promise<void> {
9898
// execute package specific settings
9999
// 1. check if a package called `<package-root>/scripts/prepack.ts` exitsts
100100
// if yes, 2.) execute that script for things that are package-specific
101-
const packagePrepackPath = path.resolve('scripts', 'prepack.ts');
102-
try {
103-
if (fs.existsSync(packagePrepackPath)) {
104-
void runPackagePrepack(packagePrepackPath);
101+
void (async () => {
102+
const packagePrepackPath = path.resolve('scripts', 'prepack.ts');
103+
try {
104+
if (fs.existsSync(packagePrepackPath)) {
105+
await runPackagePrepack(packagePrepackPath);
106+
}
107+
} catch (error) {
108+
console.error(`Error while trying to access ${packagePrepackPath.toString()}`);
109+
process.exit(1);
105110
}
106-
} catch (error) {
107-
console.error(`Error while trying to access ${packagePrepackPath.toString()}`);
108-
process.exit(1);
109-
}
110-
111-
console.log(`\nSuccessfully finished prepack commands for ${pkgJson.name}\n`);
111+
console.log(`\nSuccessfully finished prepack commands for ${pkgJson.name}\n`);
112+
})();

0 commit comments

Comments
 (0)