#!/usr/bin/env bash # Compile the plexus UIs to distributable files — this repo's `vite build`. # # Usage: # ./ctrl/dist.sh # standalone # ./ctrl/dist.sh sample # a named room # # A plexus is a UI that gets EXPORTED, not served. The output is a single # index.html carrying its theme, its data and its diagrams inline, so it opens # from a double-click on a machine with no server, no node and no network — the # state a regulated Windows box is usually in. # # `make build` runs this as one of its steps. This exists for the loop where the # UI is what you are working on: rebuilding a whole room to see a CSS change is # a slow way to iterate. set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT_DIR="$(dirname "$SCRIPT_DIR")" cd "$ROOT_DIR" PYTHON="${PYTHON:-python3}" ROOM="${1:-standalone}" if [[ ! -d "cfg/$ROOM" ]]; then echo "No such room: cfg/$ROOM" >&2 echo "Available: $(find cfg -mindepth 1 -maxdepth 1 -type d -not -name '.*' -printf '%f ')" >&2 exit 1 fi exec "$PYTHON" build.py --plexuses --cfg "$ROOM"