Add combined development server launcher

This commit is contained in:
2026-07-10 19:09:16 -07:00
parent 9a5a319cb9
commit 929941b8ff
3 changed files with 48 additions and 2 deletions

View File

@@ -173,8 +173,16 @@ pirats/
### Frontend Development
Run the backend (`pirats --reload`) and the Vite dev server side by side; Vite proxies `/api` to port 8000:
Start the backend and Vite dev server together from the repository root. Pressing Ctrl-C stops both:
```bash
./dev.sh
```
To run only the frontend, start the backend separately on port 8000, then run:
```bash
cd frontend && npm install && npm run dev
```
Vite proxies `/api` to the backend on port 8000.

38
dev.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PIDS=()
cleanup() {
local status=$?
trap - EXIT INT TERM
if ((${#PIDS[@]})); then
kill "${PIDS[@]}" 2>/dev/null || true
wait "${PIDS[@]}" 2>/dev/null || true
fi
exit "$status"
}
trap cleanup EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
cd "$ROOT_DIR"
echo "Starting backend at http://localhost:8000"
"$ROOT_DIR/.venv/bin/uvicorn" pirats.main:app --host 0.0.0.0 --port 8000 --reload &
PIDS+=("$!")
echo "Starting frontend at http://localhost:5173"
(
cd "$ROOT_DIR/frontend"
exec ./node_modules/.bin/vite
) &
PIDS+=("$!")
echo "Press Ctrl-C to stop both servers."
wait

View File

@@ -6,7 +6,7 @@
// - Add a CHANGELOG entry only when a commit changes something players can
// see. Skip refactors, tests, and tooling. Keep wording player-facing.
export const VERSION = 21;
export const VERSION = 22;
// Newest first. Each entry: { version, date: 'YYYY-MM-DD', changes: [string, ...] }.
export const CHANGELOG = [