This commit is contained in:
2026-03-26 11:33:03 +01:00
commit 1f20359fa3
30 changed files with 7849 additions and 0 deletions

62
scripts/dev-all.mjs Normal file
View File

@@ -0,0 +1,62 @@
import { spawn } from 'node:child_process';
function spawnNpmScript(scriptName) {
const npmExecPath = process.env.npm_execpath;
if (npmExecPath) {
return spawn(process.execPath, [npmExecPath, 'run', scriptName], {
stdio: 'inherit',
env: process.env,
});
}
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
return spawn(npmCommand, ['run', scriptName], {
stdio: 'inherit',
env: process.env,
shell: process.platform === 'win32',
});
}
const backend = spawnNpmScript('dev:backend');
const frontend = spawnNpmScript('dev:frontend');
let shuttingDown = false;
function shutdown(code = 0) {
if (shuttingDown) {
return;
}
shuttingDown = true;
if (backend && !backend.killed) {
backend.kill('SIGTERM');
}
if (frontend && !frontend.killed) {
frontend.kill('SIGTERM');
}
process.exit(code);
}
backend.on('exit', (code) => {
shutdown(code ?? 0);
});
frontend.on('exit', (code) => {
shutdown(code ?? 0);
});
backend.on('error', (error) => {
console.error('[dev:all] backend failed:', error);
shutdown(1);
});
frontend.on('error', (error) => {
console.error('[dev:all] frontend failed:', error);
shutdown(1);
});
process.on('SIGINT', () => shutdown(0));
process.on('SIGTERM', () => shutdown(0));