#!/usr/bin/env bash set -euo pipefail echo "==> Starting bevy web dev server" HOST="${BEVY_SERVE_HOST:-127.0.0.1}" PORT="${BEVY_SERVE_PORT:-4000}" # Set BEVY_SERVE_OPEN=0 to skip launching a browser (e.g. on headless machines). OPEN="${BEVY_SERVE_OPEN:-1}" # Print a helpful URL when running inside a Codespace. if [[ -n "${CODESPACE_NAME:-}" ]]; then DOMAIN="${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-github.dev}" echo " Codespaces URL: https://${CODESPACE_NAME}-${PORT}.${DOMAIN}" else echo " Local URL: http://localhost:${PORT}" fi echo "" REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" echo "==> Fetching terminal fonts" "$REPO_ROOT/scripts/fetch-fonts.sh" # A develop run is always a dev build, so the loading screen and status bar # show the build stamp. # shellcheck source=build-stamp.sh source "$REPO_ROOT/scripts/build-stamp.sh" capture_build_stamp dev build_info_json > "$REPO_ROOT/web/build-info.json" export_build_stamp echo "==> Building ATProto JS bundle" (cd "$REPO_ROOT/web" && npm install --silent && npm run build) echo "" OPEN_ARG=() if [[ "$OPEN" != "0" ]]; then OPEN_ARG=(--open) fi cd "$REPO_ROOT" exec bevy run --verbose -p protokill_wasm_frontend web "${OPEN_ARG[@]}" \ --host "${HOST}" --port "${PORT}" \ -H "Cache-Control: no-store"