nyanoblog/scripts/dev-server.js
2022-12-05 02:01:35 +01:00

26 lines
684 B
JavaScript
Executable file

#!/usr/bin/env node
import { spawn } from "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");
});