Files
bincio-wiki/scripts/dev.sh
T
2026-05-01 21:55:55 +02:00

33 lines
1.1 KiB
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")/.."
# Shared DB: use SHARED_DB_PATH env var if set, else fall back to the
# standard bincio_activity dev location created by its dev_test.py --fresh.
if [[ -z "$SHARED_DB_PATH" ]]; then
SHARED_DB_PATH="/tmp/bincio_dev_test/instance.db"
if [[ ! -f "$SHARED_DB_PATH" ]]; then
echo "⚠ Shared DB not found at $SHARED_DB_PATH"
echo " Run bincio_activity's dev_test.py first:"
echo " cd ../bincio_activity && uv run python scripts/dev_test.py --fresh"
echo " Or set SHARED_DB_PATH to an existing instance.db."
exit 1
fi
fi
export SHARED_DB_PATH
# Start edit sidecar if requested
if [[ "$*" == *"--edit"* ]]; then
echo "Starting edit sidecar on :8001... (DB: $SHARED_DB_PATH)"
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