feat: auto-merge all Nitro config .example files with missing key detection

This commit is contained in:
root
2026-06-06 16:38:48 +02:00
parent 834908df9f
commit ccbd200464
4 changed files with 89 additions and 16 deletions
+14 -16
View File
@@ -134,23 +134,21 @@ yarn build
echo "--> Synchronizing Gamedata configurations..."
mkdir -p "$GAMEDATA_CONF_DIR"
# --- Renderer Config Sync (always from latest example) ---
if [ -f "$NITRO_SRC_DIR/renderer-config.example" ]; then
echo "--> Updating renderer-config.json from latest example..."
cp "$NITRO_SRC_DIR/renderer-config.example" "$GAMEDATA_CONF_DIR/renderer-config.json"
fi
MERGE_SCRIPT="$(dirname "$0")/scripts/merge-config.cjs"
# --- UI Config Sync (always from latest example) ---
if [ -f "$NITRO_SRC_DIR/ui-config.json.example" ]; then
echo "--> Updating ui-config.json from latest example..."
cp "$NITRO_SRC_DIR/ui-config.json.example" "$GAMEDATA_CONF_DIR/ui-config.json"
fi
# --- UITexts Sync (always from latest example) ---
if [ -f "$NITRO_SRC_DIR/UITexts.json5.example" ]; then
echo "--> Updating UITexts.json5 from latest example..."
cp "$NITRO_SRC_DIR/UITexts.json5.example" "$GAMEDATA_CONF_DIR/UITexts.json5"
fi
echo "--> Merging Nitro config examples into Gamedata/config..."
for example_file in "$NITRO_SRC_DIR"/*.example; do
[ -f "$example_file" ] || continue
base=$(basename "$example_file")
target_name="${base%.example}"
case "$target_name" in
*.*) ;; # already has extension (e.g., .json, .json5)
*) target_name="$target_name.json" ;; # no extension -> add .json
esac
target_path="$GAMEDATA_CONF_DIR/$target_name"
echo "--> Processing $base -> $target_name..."
node "$MERGE_SCRIPT" "$example_file" "$target_path"
done
# ----------------------------------------