tiny-army-zerogpu / build.sh
polats's picture
Space: theme-independent parchment (no theme redirect), full 47-char roster, fonts via Gradio vars
74df6c5
Raw
History Blame Contribute Delete
1.65 kB
#!/usr/bin/env bash
# Bundle the shared, framework-agnostic JS modules from the auto-battler repo into
# this Space's web/ dir. Pixi is INJECTED by the caller (web/tiny.js imports it
# from a CDN and passes it in), so none of these modules import Pixi — nothing to
# mark external. Run from the tiny-army dir with ../auto-battler alongside.
#
# ./build.sh # uses ../auto-battler
# AB=/path ./build.sh # override the source repo
set -euo pipefail
AB="${AB:-../auto-battler}"
# 1. JS engine/render core → bundled (Pixi injected, so nothing external).
npx --yes esbuild "$AB/src/engine/teamBattle.js" --bundle --format=esm --outfile=web/engine.js
npx --yes esbuild "$AB/src/render/spriteSheet.js" --bundle --format=esm --outfile=web/sheet.js
npx --yes esbuild "$AB/src/render/spriteScene.js" --bundle --format=esm --outfile=web/scene.js
npx --yes esbuild "$AB/src/render/spritePlayground.js" --bundle --format=esm --outfile=web/playground.js
# 2. App shell (nav IR + sidebar CSS/JS) + the playground chrome CSS → copied
# verbatim, so they can't drift from the React app, which renders the same files.
mkdir -p web/shell
cp "$AB/src/shell/nav.json" "$AB/src/shell/sidebar.css" "$AB/src/shell/sidebar.js" web/shell/
cp "$AB/src/render/spriteScene.css" web/shell/spriteScene.css
# 3. Assets → use auto-battler's FULL character manifest (so the Space lists every
# character, like the app) and curate every sheet it references (~1 MB).
cp "$AB/public/assets/characters.json" web/assets/characters.json
AB="$AB" python3 curate_assets.py
echo "synced web/{engine,sheet,scene}.js + web/shell/* + assets from $AB"