mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-09-19 09:40:14 +00:00
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
41 lines
804 B
JavaScript
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));
|