Files

17 lines
555 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Serves dist/ locally for manual browser testing. No COOP/COEP headers are
# needed since this build is single-threaded (no pthreads/SharedArrayBuffer).
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DIST_DIR="$ROOT_DIR/dist"
PORT="${1:-8080}"
if [ ! -f "$DIST_DIR/index.html" ] && [ ! -f "$DIST_DIR/vpinball.js" ]; then
echo "ERROR: dist/ is empty. Run scripts/build.sh first." >&2
exit 1
fi
echo "Serving $DIST_DIR at http://localhost:$PORT/"
cd "$DIST_DIR" && python3 -m http.server "$PORT"