#!/usr/bin/env bash # Assemble dist/: the static site, self-contained, served from any web root. # Usage: scripts/build-dist.sh (runs scripts/build-wasm.sh first) set -euo pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT" # The licences and notices page, from the build's dependency tree; stops the build when a # family crate has no LICENSE (BSD-3 and MIT ask for their notices with the binary). python3 -I scripts/notices.py scripts/build-wasm.sh mkdir -p dist/pkg cp web/index.html web/notices.html web/style.css web/app.js web/controls.js web/audio-worklet.js web/icon.svg web/robots.txt web/manifest.json dist/ cp web/pkg/play_md.js web/pkg/play_md_bg.wasm dist/pkg/ mkdir -p dist/games cp web/games/* dist/games/ commit=$(git rev-parse --short HEAD 2>/dev/null || echo none)$(git diff --quiet HEAD -- . ':!dist' 2>/dev/null || echo "-dirty") board=$(git -C ../megadrive-rust-fast rev-parse --short HEAD) printf '{"commit": "%s", "board": "%s", "built": "%s"}\n' "$commit" "$board" "$(date -u +%Y-%m-%dT%H:%MZ)" > dist/version.json echo "dist/ built at $commit (board $board): $(find dist -type f | wc -l) files, $(du -sh dist | cut -f1)"