Files
nezha-dash-v1/scripts/dev-mock.js
T
hamster1963 6c7ba30cee feat: refactor DashCommand to use useMemo for shortcuts and server commands
feat: optimize GlobalMap component with useMemo for country data processing

feat: enhance ServerCard and ServerCardInline components with memoization

feat: improve ServiceTracker component by processing service data with useMemo

feat: add VirtualServerList component for efficient rendering of server lists

refactor: update Servers page to utilize VirtualServerList for better performance

test: add tests for DashCommand and GlobalMap components, including virtualization checks
2026-07-05 04:09:22 +08:00

41 lines
804 B
JavaScript

import { spawn } from "node:child_process";
const isWindows = process.platform === "win32";
const pnpmCommand = isWindows ? "pnpm.cmd" : "pnpm";
const children = [
spawn(process.execPath, ["scripts/mock-nezha-server.js"], {
stdio: "inherit",
}),
spawn(pnpmCommand, ["dev"], {
stdio: "inherit",
}),
];
let shuttingDown = false;
function shutdown(exitCode = 0) {
if (shuttingDown) return;
shuttingDown = true;
for (const child of children) {
if (!child.killed) {
child.kill("SIGTERM");
}
}
process.exit(exitCode);
}
for (const child of children) {
child.on("exit", (code, signal) => {
if (shuttingDown) return;
if (code === 0 || signal === "SIGTERM") return;
shutdown(code ?? 1);
});
}
process.on("SIGINT", () => shutdown(0));
process.on("SIGTERM", () => shutdown(0));