mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 05:32:06 +00:00
refactor: run NodeCG from lib/scoreko-dev for Node 24 migration
This commit is contained in:
+22
-10
@@ -4,7 +4,7 @@ import net from "node:net";
|
||||
import path from "node:path";
|
||||
|
||||
const cwd = process.cwd();
|
||||
const nodecgRootPath = path.resolve(cwd, "lib", "nodecg");
|
||||
const scorekoRootPath = path.resolve(cwd, "lib", "scoreko-dev");
|
||||
|
||||
const checks = [];
|
||||
|
||||
@@ -36,19 +36,31 @@ function parseIntInRange(name, fallback, min, max) {
|
||||
}
|
||||
|
||||
function checkNodecgInstall() {
|
||||
const indexPath = path.join(nodecgRootPath, "index.js");
|
||||
const bundleName = (process.env.NODECG_BUNDLE_NAME ?? "scoreko-dev").trim();
|
||||
const bundlePath = path.join(nodecgRootPath, "bundles", bundleName);
|
||||
const packageJsonPath = path.join(scorekoRootPath, "package.json");
|
||||
const nodecgCliPath = path.join(
|
||||
scorekoRootPath,
|
||||
"node_modules",
|
||||
".bin",
|
||||
process.platform === "win32" ? "nodecg.cmd" : "nodecg",
|
||||
);
|
||||
const bundleAssetPaths = ["dashboard", "graphics", "extension", "extensions"].map((folder) =>
|
||||
path.join(scorekoRootPath, folder),
|
||||
);
|
||||
|
||||
addCheck(fs.existsSync(nodecgRootPath), "NodeCG root", nodecgRootPath);
|
||||
addCheck(fs.existsSync(indexPath), "NodeCG index.js", indexPath);
|
||||
addCheck(fs.existsSync(bundlePath), `Bundle '${bundleName}'`, bundlePath);
|
||||
addCheck(fs.existsSync(scorekoRootPath), "Scoreko root", scorekoRootPath);
|
||||
addCheck(fs.existsSync(packageJsonPath), "scoreko-dev package.json", packageJsonPath);
|
||||
addCheck(fs.existsSync(nodecgCliPath), "NodeCG CLI", nodecgCliPath);
|
||||
addCheck(
|
||||
bundleAssetPaths.some((candidatePath) => fs.existsSync(candidatePath)),
|
||||
"scoreko-dev bundle assets",
|
||||
`Expected one of: ${bundleAssetPaths.join(", ")}`,
|
||||
);
|
||||
|
||||
try {
|
||||
fs.accessSync(nodecgRootPath, fs.constants.R_OK | fs.constants.W_OK);
|
||||
addCheck(true, "lib/nodecg permissions", "Read/write OK");
|
||||
fs.accessSync(scorekoRootPath, fs.constants.R_OK | fs.constants.W_OK);
|
||||
addCheck(true, "lib/scoreko-dev permissions", "Read/write OK");
|
||||
} catch {
|
||||
addCheck(false, "lib/nodecg permissions", "No read/write permissions in lib/nodecg");
|
||||
addCheck(false, "lib/scoreko-dev permissions", "No read/write permissions in lib/scoreko-dev");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ import path from "node:path";
|
||||
import { spawn } from "node:child_process";
|
||||
|
||||
const root = process.cwd();
|
||||
const nodecgDir = path.join(root, "lib", "nodecg");
|
||||
const sqliteLegacyDir = path.join(nodecgDir, "workspaces", "database-adapter-sqlite-legacy");
|
||||
const scorekoDir = path.join(root, "lib", "scoreko-dev");
|
||||
const sqliteLegacyDir = path.join(scorekoDir, "workspaces", "database-adapter-sqlite-legacy");
|
||||
|
||||
const moduleDirs = [nodecgDir, sqliteLegacyDir].filter((dir) => existsSync(path.join(dir, "package.json")));
|
||||
const moduleDirs = [scorekoDir, sqliteLegacyDir].filter((dir) => existsSync(path.join(dir, "package.json")));
|
||||
|
||||
if (moduleDirs.length === 0) {
|
||||
console.error("No NodeCG package folders found. Expected lib/nodecg and/or workspaces.");
|
||||
console.error("No package folders found. Expected lib/scoreko-dev and/or workspaces.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user