Skip to content

Commit

Permalink
fix: move process exit up to the CLI (tajo#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
tajo authored Mar 30, 2021
1 parent 79e2c4c commit 9034b6a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions packages/ladle/lib/cli/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ const build = async (params = {}) => {

debug(`Final config:\n${JSON.stringify(config, null, " ")}`);
process.env["SNOWPACK_PUBLIC_LADLE_THEME"] = config.addons.theme.defaultState;
await snowpackProd(config, configFolder);
process.exit(0);
return snowpackProd(config, configFolder);
};

export default build;
8 changes: 7 additions & 1 deletion packages/ladle/lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ program
"additional folders where source code can be",
(str) => str.split(","),
)
.action(build);
.action(async (params) => {
const success = await build(params);
if (success) {
process.exit(0);
}
process.exit(1);
});

program.parse(process.argv);
7 changes: 2 additions & 5 deletions packages/ladle/lib/cli/snowpack-prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ const snowpackProd = async (config, configFolder) => {
await build({ config: buildConfig, lockfile: null });
} catch (e) {
console.log(e);
process.exit(1);
return false;
}
if (successfulExit) {
process.exit(0);
}
process.exit(1);
return successfulExit;
};

export default snowpackProd;

0 comments on commit 9034b6a

Please sign in to comment.