You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
707 B

import { spawn } from 'node:child_process';
import 'dotenv/config';
const children = [
spawn(process.execPath, ['--watch', 'server/index.mjs'], {
stdio: 'inherit',
env: { ...process.env, NODE_ENV: 'development', PORT: '3001' },
}),
spawn(process.execPath, ['node_modules/vite/bin/vite.js'], {
stdio: 'inherit',
env: { ...process.env, NODE_ENV: 'development' },
}),
];
let stopping = false;
function stop(code = 0) {
if (stopping) return;
stopping = true;
for (const child of children) child.kill();
process.exitCode = code;
}
for (const child of children) child.on('exit', (code) => stop(code ?? 1));
process.on('SIGINT', () => stop());
process.on('SIGTERM', () => stop());

Powered by TurnKey Linux.