mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 13:42:06 +00:00
Add NodeCG preflight step and sanity script
This commit is contained in:
@@ -30,6 +30,7 @@ type NodecgProcessManagerDeps = {
|
||||
};
|
||||
|
||||
export type NodecgProcessManager = {
|
||||
runPreflightChecks: () => Promise<void>;
|
||||
startNodecgProcess: () => Promise<ChildProcess>;
|
||||
waitForNodecgReady: (startTime: number) => Promise<void>;
|
||||
stopNodecgProcessGracefully: () => Promise<void>;
|
||||
@@ -51,7 +52,7 @@ export function createNodecgProcessManager({
|
||||
let lastExit: { code: number | null; signal: NodeJS.Signals | null } | null = null;
|
||||
let lastStderrLine: string | null = null;
|
||||
|
||||
const startNodecgProcess = async (): Promise<ChildProcess> => {
|
||||
const runPreflightChecks = async (): Promise<void> => {
|
||||
validateNodecgInstall(
|
||||
nodecgRootPath,
|
||||
resolvedDeps.platform,
|
||||
@@ -66,6 +67,10 @@ export function createNodecgProcessManager({
|
||||
`Port ${appConfig.nodecgPort} is already in use. Stop the process using it or set NODECG_PORT before starting.`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const startNodecgProcess = async (): Promise<ChildProcess> => {
|
||||
await runPreflightChecks();
|
||||
|
||||
const command = resolvedDeps.platform === "win32" ? "npx.cmd" : "npx";
|
||||
const child = resolvedDeps.spawnProcess(command, ["nodecg", "start"], {
|
||||
@@ -186,6 +191,7 @@ export function createNodecgProcessManager({
|
||||
};
|
||||
|
||||
return {
|
||||
runPreflightChecks,
|
||||
startNodecgProcess,
|
||||
waitForNodecgReady,
|
||||
stopNodecgProcessGracefully,
|
||||
|
||||
Reference in New Issue
Block a user