Skip to content

Commit

Permalink
chore: log elm-live errors on stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesboris committed Mar 26, 2021
1 parent 8d9b279 commit 2a896a2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bin/elm-ui-book.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

const exec = require("child_process").exec;
const entryPoint = process.argv[2];
const args = process.argv.slice(3);
const extraArgs = process.argv.slice(3).join(" ");

if (!entryPoint) {
console.warn("elm-ui-book: please specify your entry point.");
process.exit(1);
} else {
exec(`elm-live ${process.argv[2]} --pushstate --open ${args}`);
exec(
`npx elm-live ${entryPoint} --pushstate --open ${extraArgs}`,
(error, stdout, stderr) => {
if (stdout) console.log(stdout);
if (error) console.warn(error);
if (stderr) console.error(stderr);
}
);
}

0 comments on commit 2a896a2

Please sign in to comment.