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
This commit is contained in:
root
2026-06-07 16:36:15 +02:00
parent 1db80e76fe
commit ef559ce64b
2 changed files with 23 additions and 15 deletions
-9
View File
@@ -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 {
+23 -6
View File
@@ -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"