Files
bincio-wiki/scripts/dev.sh
T

29 lines
766 B
Bash
Executable File

#!/usr/bin/env bash
# Start the Astro dev server and optionally the edit sidecar.
# Usage: scripts/dev.sh [--edit]
set -e
cd "$(dirname "$0")/.."
ROOT="$(pwd)"
# Symlink wiki pages into the site's content collection
mkdir -p pages
mkdir -p site/src/content/entries
LINK="$ROOT/site/src/content/entries/_wiki"
if [ ! -L "$LINK" ]; then
ln -sf "$ROOT/pages" "$LINK"
echo "Linked pages/ → site/src/content/entries/_wiki"
fi
# Start edit sidecar if requested
if [[ "$*" == *"--edit"* ]]; then
echo "Starting edit sidecar on :8001..."
uv sync -q
uv run uvicorn edit.server:app --reload --port 8001 &
SIDECAR_PID=$!
trap "kill $SIDECAR_PID 2>/dev/null" EXIT
fi
# Start Astro dev server
export PUBLIC_EDIT_URL="${WIKI_EDIT_URL:-}"
cd site && npm run dev