#!/usr/bin/env bash # Assemble the deployed single-file pages from source + assets/. # # The source index.html keeps small @BUILD:* markers instead of the large base64 # blobs (audio samples, brand logos, favicon). This inlines those assets so the # built page in dist/ is one self-contained file (zero deps, works fully offline). # deploy.sh runs this first. dist/ is generated — don't edit or commit it. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" mkdir -p dist python3 - <<'PY' import json, os, pathlib A = pathlib.Path("assets") src = pathlib.Path("index.html").read_text() src = src.replace("@BUILD:favicon@", (A / "favicon.b64").read_text().strip()) src = src.replace("@BUILD:logo-dark@", (A / "logo-dark.b64").read_text().strip()) src = src.replace("@BUILD:logo-light@", (A / "logo-light.b64").read_text().strip()) src = src.replace("/*@BUILD:samples@*/{}", json.dumps(json.load(open(A / "samples.json")))) assert "@BUILD:" not in src, "unresolved build marker(s) remain in index.html" pathlib.Path("dist/index.html").write_text(src) pathlib.Path("dist/player.html").write_text(pathlib.Path("player.html").read_text()) # no assets to inline print("built dist/index.html (%dKB) + dist/player.html (%dKB)" % (os.path.getsize("dist/index.html") // 1024, os.path.getsize("dist/player.html") // 1024)) PY