ui work
This commit is contained in:
32
ctrl/dist.sh
32
ctrl/dist.sh
@@ -2,30 +2,36 @@
|
||||
# Compile the plexus UIs to distributable files — this repo's `vite build`.
|
||||
#
|
||||
# Usage:
|
||||
# ./ctrl/dist.sh # standalone
|
||||
# ./ctrl/dist.sh sample # a named room
|
||||
# ./ctrl/dist.sh # every plexus -> gen/plexuses/<name>/index.html
|
||||
# ./ctrl/dist.sh bundle # one, by name
|
||||
# ./ctrl/dist.sh path/to/ui.toml # every [[plexus]] a run file lists
|
||||
# ./ctrl/dist.sh bundle --dest /tmp/out --delivery vendored --notice none
|
||||
#
|
||||
# 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.
|
||||
# It needs nothing built first: a plexus is its own directory under
|
||||
# soleprint/artery/plexuses/ (or wherever a run file points), and the theme it
|
||||
# carries is cut to what the page reads. See soleprint/common/slice/plexus.py.
|
||||
set -e
|
||||
|
||||
CALLER_DIR="$PWD"
|
||||
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
|
||||
args=()
|
||||
for a in "$@"; do
|
||||
# A bare word that names an existing path is a path the caller typed.
|
||||
if [[ "$a" != -* && -e "$CALLER_DIR/$a" ]]; then
|
||||
args+=("$(cd "$CALLER_DIR" && realpath -m -- "$a")")
|
||||
else
|
||||
args+=("$a")
|
||||
fi
|
||||
done
|
||||
|
||||
exec "$PYTHON" build.py --plexuses --cfg "$ROOM"
|
||||
cd "$ROOT_DIR/soleprint"
|
||||
exec "$PYTHON" -m common.slice plexus "${args[@]}"
|
||||
|
||||
Reference in New Issue
Block a user