mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 05:32:06 +00:00
feat: Restore Electron renderer and enhance NodeCG runtime management
This commit is contained in:
@@ -92,7 +92,7 @@ test("prepareUserNodecgRuntime keeps an up-to-date runtime in place", () => {
|
||||
const source = path.normalize("/app/lib/nodecg");
|
||||
const userData = path.normalize("/user/scoreko");
|
||||
const target = path.join(userData, "nodecg");
|
||||
const sourceManifest = { bundleVersion: "0.1.0", nodecgVersion: "2.6.4" };
|
||||
const sourceManifest = { bundleVersion: "0.1.0", generatedAt: "2026-05-24T00:00:00.000Z", nodecgVersion: "2.6.4" };
|
||||
const targetManifest = { appVersion: "0.1.0", bundleName: "scoreko-dev", sourceRuntime: sourceManifest };
|
||||
const { state, deps } = createFakeFs(
|
||||
[
|
||||
@@ -125,7 +125,7 @@ test("prepareUserNodecgRuntime refreshes managed files when the app version chan
|
||||
const source = path.normalize("/app/lib/nodecg");
|
||||
const userData = path.normalize("/user/scoreko");
|
||||
const target = path.join(userData, "nodecg");
|
||||
const sourceManifest = { bundleVersion: "0.1.0", nodecgVersion: "2.6.4" };
|
||||
const sourceManifest = { bundleVersion: "0.1.0", generatedAt: "2026-05-24T00:00:00.000Z", nodecgVersion: "2.6.4" };
|
||||
const targetManifest = { appVersion: "0.0.9", bundleName: "scoreko-dev", sourceRuntime: sourceManifest };
|
||||
const { state, deps } = createFakeFs(
|
||||
[
|
||||
@@ -155,3 +155,42 @@ test("prepareUserNodecgRuntime refreshes managed files when the app version chan
|
||||
assert.ok(state.removed.includes(path.join(target, "bundles")));
|
||||
assert.ok(!state.removed.includes(path.join(target, "db")));
|
||||
});
|
||||
|
||||
test("prepareUserNodecgRuntime refreshes managed files when the source runtime was regenerated", () => {
|
||||
const source = path.normalize("/app/lib/nodecg");
|
||||
const userData = path.normalize("/user/scoreko");
|
||||
const target = path.join(userData, "nodecg");
|
||||
const sourceManifest = { bundleVersion: "0.1.0", generatedAt: "2026-05-24T01:00:00.000Z", nodecgVersion: "2.6.4" };
|
||||
const targetSourceManifest = {
|
||||
bundleVersion: "0.1.0",
|
||||
generatedAt: "2026-05-24T00:00:00.000Z",
|
||||
nodecgVersion: "2.6.4",
|
||||
};
|
||||
const targetManifest = { appVersion: "0.1.0", bundleName: "scoreko-dev", sourceRuntime: targetSourceManifest };
|
||||
const { state, deps } = createFakeFs(
|
||||
[
|
||||
...getSourcePaths(source),
|
||||
path.join(target, "node_modules", "nodecg", "dist", "server", "bootstrap.js"),
|
||||
path.join(target, "bundles", "scoreko-dev", "package.json"),
|
||||
path.join(target, ".scoreko-installed-runtime.json"),
|
||||
],
|
||||
{
|
||||
[path.join(source, ".scoreko-runtime.json")]: JSON.stringify(sourceManifest),
|
||||
[path.join(target, ".scoreko-installed-runtime.json")]: JSON.stringify(targetManifest),
|
||||
},
|
||||
);
|
||||
|
||||
const preparedRuntime = prepareUserNodecgRuntime({
|
||||
sourceRuntimePath: source,
|
||||
userDataPath: userData,
|
||||
appVersion: "0.1.0",
|
||||
bundleName: "scoreko-dev",
|
||||
log: () => undefined,
|
||||
deps,
|
||||
});
|
||||
|
||||
assert.equal(preparedRuntime.installed, true);
|
||||
assert.equal(state.copied.length, 1);
|
||||
assert.ok(state.removed.includes(path.join(target, "bundles")));
|
||||
assert.ok(!state.removed.includes(path.join(target, "cfg")));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user