Skip to content

Commit

Permalink
Merge pull request #293 from krymtkts:feature/supress-react-logs
Browse files Browse the repository at this point in the history
Update `build-md` task to use the wrapper script.
  • Loading branch information
krymtkts authored Dec 26, 2024
2 parents 4eb60bb + b5daafc commit 48f096d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"postinstall": "dotnet tool restore",
"build-fable": "dotnet fable src --runScript",
"build-md": "node ./src/App.fs.js",
"build-md": "node ./scripts/build-md.js dev",
"build-css": "sass --style=compressed --no-source-map ./sass/style.scss ./docs/blog-fable/css/style.css",
"build-index": "pagefind",
"build": "npm run build-css && npm run build-fable && npm run build-index",
Expand Down
31 changes: 31 additions & 0 deletions scripts/build-md.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { spawn } from "node:child_process";

const arg = process.argv[2];
console.log("Run App.fs.js with mode:", arg);

const run = () =>
new Promise((resolve, reject) => {
process.env.NODE_ENV = "production";
const child = spawn("node", ["./src/App.fs.js", arg]);

child.stdout.on("data", (data) => {
process.stdout.write(data);
});
child.stderr.on("data", (data) => {
process.stderr.write(data);
});
child.on("close", (code) => {
if (code !== 0) {
reject(new Error(`Child process exited with code ${code}`));
} else {
resolve();
}
});
});

try {
await run();
} catch (error) {
console.error("Error running script:", error);
exit(1);
}

0 comments on commit 48f096d

Please sign in to comment.