#!/usr/bin/env bash # One command to run the marketing site with live reload: builds the # Ising-simulation wasm module if it's missing (or if the crate changed — # see below), installs site/node_modules if needed, then runs `astro dev`. # Editing a page, a config/*.ts value, or copy in data/*.ts shows up on # save; editing crates/didbot-site-anim requires a re-run of this script # (or of scripts/build-wasm.sh directly) since wasm compilation is not part # of Astro's own watch graph. # # Usage: scripts/dev-site.sh [astro-dev-flags...] # Then open http://localhost:4321/ (Astro's default dev port; override it # with `scripts/dev-site.sh --port 4322`). set -euo pipefail cd "$(dirname "$0")/.." wasm_out="site/public/wasm/site-anim_bg.wasm" if [ ! -f "$wasm_out" ]; then echo "dev-site: $wasm_out is missing; building it first (scripts/build-wasm.sh)" >&2 scripts/build-wasm.sh else echo "dev-site: $wasm_out already exists; skipping the wasm build." >&2 echo " If you changed crates/didbot-site-anim and want the dev server to see" >&2 echo " it, run scripts/build-wasm.sh yourself, then reload the page." >&2 fi if [ ! -d site/node_modules ]; then echo "dev-site: site/node_modules is missing; running 'npm ci' first" >&2 (cd site && npm ci) fi echo "dev-site: starting the Astro dev server (default: http://localhost:4321/)" >&2 cd site exec npm run dev -- "$@"