ninelands-reddit/scripts/sync-engine.sh
Lukas Müllner 3621eb3214 feat: Engine-Kopie von Ninelands v0.11.0, Tageskarte mit eigenem Seed, Assets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:02:11 +01:00

37 lines
1.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Holt die Engine (src/core + die JSONs, die sie importiert) von einem festen Ninelands-Tag nach src/engine/,
# dazu Sprites (Tiles, Brett-Themen) und ausgewählte Musik nach public/.
# Die Kopie wird nie von Hand geändert – Änderungen gehören ins Hauptspiel, dann hier neu synchronisieren.
# Aufruf: scripts/sync-engine.sh <tag> [pfad-zum-hivedoku-repo]
set -euo pipefail
tag="${1:?Tag angeben, z. B. v0.11.0}"
repo="${2:-${HIVEDOKU_REPO:-/data/Documents/projects/hivedoku}}"
ziel="$(cd "$(dirname "$0")/.." && pwd)/src/engine"
# Nur lesen: git archive verändert das Hauptspiel-Repo nicht
commit="$(git -C "$repo" rev-parse --verify "$tag^{commit}")"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
# Musik: nur MP3 (läuft überall, auch in iOS-Webviews) und nur wenige Titel – jeder ≈ 2 MB
musik=(peaceful-village)
musik_pfade=()
for titel in "${musik[@]}"; do musik_pfade+=("public/audio/music/$titel.mp3"); done
git -C "$repo" archive "$commit" src/core src/campaign src/puzzles public/sprites/tiles public/sprites/themes \
"${musik_pfade[@]}" | tar -x -C "$tmp"
# Alte Kopie ersetzen, eigene Dateien (tsconfig.json, README.md) behalten
rm -rf "$ziel/core" "$ziel/campaign" "$ziel/puzzles"
mkdir -p "$ziel"
cp -r "$tmp/src/core" "$tmp/src/campaign" "$tmp/src/puzzles" "$ziel/"
find "$ziel" -name '*.test.ts' -delete
# Assets (Nachweise in CREDITS.md)
public="$(dirname "$ziel")/../public"
rm -rf "$public/sprites" "$public/audio"
mkdir -p "$public/sprites" "$public/audio"
cp -r "$tmp/public/sprites/tiles" "$tmp/public/sprites/themes" "$public/sprites/"
cp -r "$tmp/public/audio/music" "$public/audio/"
printf 'tag: %s\ncommit: %s\n' "$tag" "$commit" > "$ziel/VERSION"
echo "Engine synchronisiert: $tag ($commit)"