diff --git a/package.json b/package.json index b02bb17b..30e5bb9a 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test-stolaf-college": "./scripts/smoke-test.sh stolaf-college", "test-carleton-college": "./scripts/smoke-test.sh carleton-college", "test": "ava", - "watch": "echo \"npm run build-watch\" and \"npm run start-watch\"" + "watch": "node ./scripts/watch.js" }, "dependencies": { "@sentry/node": "^8.0.0-rc.1", diff --git a/scripts/watch.js b/scripts/watch.js new file mode 100644 index 00000000..1189dee7 --- /dev/null +++ b/scripts/watch.js @@ -0,0 +1,13 @@ +import {spawn} from 'child_process' + +const buildWatch = spawn('npm', ['run', 'build-watch'], {stdio: 'inherit'}) +const startWatch = spawn('npm', ['run', 'start-watch'], {stdio: 'inherit'}) + +const shutdown = () => { + buildWatch.kill() + startWatch.kill() + process.exit() +} + +process.on('SIGINT', shutdown) +process.on('SIGTERM', shutdown)