#!/usr/bin/env bash # Drift gate for the committed admin SPA build (D-04). Rebuilds admin/ from # the committed lockfile into a temporary directory and fails when the result # differs from modules/boardwalk/dist, the tree the Go binary embeds. After # changing the SPA, rebuild with `npm --prefix admin run build` and commit the result. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT" if [[ ! -d admin/node_modules ]]; then npm --prefix admin ci fi npm --prefix admin run typecheck TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT (cd admin && node_modules/.bin/vite build --outDir "$TMP/dist" --emptyOutDir --logLevel warn) if ! diff -r "$TMP/dist" modules/boardwalk/dist; then echo "check-admin-dist: modules/boardwalk/dist is stale; run npm --prefix admin run build and commit modules/boardwalk/dist" >&2 exit 1 fi echo "check-admin-dist: modules/boardwalk/dist matches a fresh build"