Initial project import
This commit is contained in:
22
scripts/dev-full.mjs
Normal file
22
scripts/dev-full.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
const commands = [
|
||||
['node', ['server/cms-server.mjs']],
|
||||
['npm', ['run', 'dev', '--', '--host', '127.0.0.1']],
|
||||
];
|
||||
|
||||
const children = commands.map(([cmd, args]) => {
|
||||
const child = spawn(cmd, args, { stdio: 'inherit', shell: false });
|
||||
child.on('exit', (code) => {
|
||||
if (code && code !== 0) {
|
||||
children.forEach((item) => item.pid !== child.pid && item.kill());
|
||||
process.exit(code);
|
||||
}
|
||||
});
|
||||
return child;
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
children.forEach((child) => child.kill('SIGINT'));
|
||||
process.exit(0);
|
||||
});
|
||||
Reference in New Issue
Block a user