fix: use jsonc-parser in config merge and make updater reliably restart all services
CI / check (push) Successful in 25s
CI / release (push) Skipped
CI / deploy (push) Successful in 58s

merge-config.cjs loaded json5 (not installed, and unable to parse JSONC
comments), so sync_configs crashed mid-update and do_restart never ran —
leaving the emulator running the old JAR.

- merge-config.cjs: switch from json5 to jsonc-parser (already a
  dependency) to parse .jsonc configs including comments
- update-Nitrov3.sh: always run renderer/client parallel builds instead
  of gating them on the emulator's update status
- update-Nitrov3.sh: isolate each repo's yarn cache (--cache-folder) so
  parallel installs can't corrupt a shared cache and silently drop
  vite/pixi.js; replace invalid --no-cache flag with per-repo cache reset
- update-Nitrov3.sh: fix misleading [DRY-RUN] label on real updates
This commit is contained in:
openhands committed 2026-08-11 19:06:29 +02:00
1 parent abc06e438c
commit 9e453666e5
2 files changed
+104 -46

No files matched your search

+31 -12
View File
@@ -1,5 +1,5 @@
const fs = require("node:fs");
const JSON5 = require("json5");
const { parse, printParseErrorCode } = require("jsonc-parser");
const exampleFile = process.argv[2];
const targetFile = process.argv[3];
@@ -26,28 +26,47 @@ function deepMerge(target, source) {
return result;
}
function parseJsonc(file) {
if (!fs.existsSync(file)) {
return undefined;
}
const content = fs.readFileSync(file, "utf-8");
const errors = [];
const value = parse(content, errors, {
allowTrailingComma: true,
allowEmptyContent: true,
});
if (errors.length > 0) {
console.error(
`[merge-config] parse error in ${file}: ${errors
.map((e) => printParseErrorCode(e.error))
.join(", ")}`,
);
return undefined;
}
return value;
}
let example;
try {
const content = fs.readFileSync(exampleFile, "utf-8");
example = JSON5.parse(content);
example = parseJsonc(exampleFile);
} catch {
process.exit(1);
}
if (example === undefined) {
process.exit(1);
}
let current = {};
try {
if (fs.existsSync(targetFile)) {
const content = fs.readFileSync(targetFile, "utf-8");
current = JSON5.parse(content);
const parsed = parseJsonc(targetFile);
if (parsed !== undefined && parsed !== null) {
current = parsed;
}
} catch {
current = {};
}
const merged = deepMerge(current, example);
const isJson5 = targetFile.endsWith(".json5");
const output = isJson5
? JSON5.stringify(merged, null, 4)
: JSON.stringify(merged, null, 4);
fs.writeFileSync(targetFile, `${output}\n`);
fs.writeFileSync(targetFile, `${JSON.stringify(merged, null, 4)}\n`);