From ef559ce64b9855e413c638a726e85e17b1453faf Mon Sep 17 00:00:00 2001 From: root Date: Sun, 7 Jun 2026 16:36:15 +0200 Subject: [PATCH] Auto-stash before git pull and sync .example configs to live files - All git pull commands now auto-stash local changes first - .example configs are now merged with live files in Nitro's public/configuration directory to keep them 100% complete - Removed unused getTargetName function from merge-config.cjs --- scripts/merge-config.cjs | 9 --------- update-Nitrov3.sh | 29 +++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/scripts/merge-config.cjs b/scripts/merge-config.cjs index 958de08..8889a75 100644 --- a/scripts/merge-config.cjs +++ b/scripts/merge-config.cjs @@ -22,15 +22,6 @@ function deepMerge(target, source) { return target; } -function getTargetName(exampleFile) { - let name = exampleFile.replace(/\.example$/, ''); - const ext = path.extname(name); - if (!ext || ext === '.example') { - name += '.json'; - } - return name; -} - const srcContent = fs.readFileSync(srcFile, 'utf8'); let srcData; try { diff --git a/update-Nitrov3.sh b/update-Nitrov3.sh index ae38505..c3a21ef 100755 --- a/update-Nitrov3.sh +++ b/update-Nitrov3.sh @@ -58,7 +58,7 @@ echo "=== Starting EPIC WEB CONTROL Update ===" # ---------------------------------------- echo "--> Updating Emulator..." cd "$EMULATOR_DIR/Emulator/" -git pull +git stash --include-untracked || true && git pull # --- Automatic Safe Database Backup --- echo "--> Creating automatic database backup before update..." @@ -105,7 +105,7 @@ chmod +x emulator echo "--> Updating Nitro_Render_V3..." cd "$NITRO_RENDERER/" -git pull +git stash --include-untracked || true && git pull echo "--> Running yarn install for Nitro_Render_V3..." clean_node_modules @@ -118,7 +118,7 @@ yarn install echo "--> Updating Nitro-V3..." cd "$NITRO_CLIENT" -git pull +git stash --include-untracked || true && git pull echo "--> Running yarn install for Nitro-V3..." clean_node_modules @@ -129,14 +129,16 @@ yarn build # ---------------------------------------- -# 4. Sync Gamedata Configs & UITexts (.example logica) +# 4. Sync Configs & UITexts (.example logica) # ---------------------------------------- -echo "--> Synchronizing Gamedata configurations..." +echo "--> Synchronizing configurations..." mkdir -p "$GAMEDATA_CONF_DIR" MERGE_SCRIPT="$(dirname "$0")/scripts/merge-config.cjs" -echo "--> Merging Nitro config examples into Gamedata/config..." +# Fase 1: Merge .example met live configs in dezelfde public directory +# zodat de Nitro client zelf altijd 100% complete configs heeft +echo "--> Merging .example files with live configs in $NITRO_SRC_DIR..." for example_file in "$NITRO_SRC_DIR"/*.example; do [ -f "$example_file" ] || continue base=$(basename "$example_file") @@ -145,6 +147,21 @@ for example_file in "$NITRO_SRC_DIR"/*.example; do *.*) ;; # already has extension (e.g., .json, .json5) *) target_name="$target_name.json" ;; # no extension -> add .json esac + live_path="$NITRO_SRC_DIR/$target_name" + echo "--> Processing $base -> $target_name (live)..." + node "$MERGE_SCRIPT" "$example_file" "$live_path" +done + +# Fase 2: Daarna dezelfde merge naar Gamedata/config voor de website +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 + *.*) ;; + *) target_name="$target_name.json" ;; + esac target_path="$GAMEDATA_CONF_DIR/$target_name" echo "--> Processing $base -> $target_name..." node "$MERGE_SCRIPT" "$example_file" "$target_path"