27 lines
689 B
JavaScript
27 lines
689 B
JavaScript
|
#!/usr/bin/env node
|
||
|
|
||
|
const { spawn } = require("node:child_process");
|
||
|
|
||
|
console.log("Starting development server");
|
||
|
|
||
|
const tsc = spawn("npm", ["run", "start:tsc"]);
|
||
|
tsc.on("exit", code => {
|
||
|
console.log(`tsc exited with code ${code}`);
|
||
|
server.kill("SIGINT");
|
||
|
});
|
||
|
tsc.stdout.on("data", console.log);
|
||
|
tsc.stderr.on("data", console.error);
|
||
|
|
||
|
const server = spawn("npm", ["run", "start:server"]);
|
||
|
server.on("exit", code => {
|
||
|
console.log(`web-dev-server exited with code ${code}`);
|
||
|
tsc.kill("SIGINT");
|
||
|
});
|
||
|
server.stderr.on("data", console.error);
|
||
|
|
||
|
process.on("SIGINT", () => {
|
||
|
console.log("SIGINT caught, shutting down");
|
||
|
server.kill("SIGINT");
|
||
|
tsc.kill("SIGINT");
|
||
|
});
|