#!/usr/bin/env bash # Start the Sabotage Town dev stack on the Node version pinned in .nvmrc (22): # • frontend — vite dev server on http://127.0.0.1:5173 (proxies /api, /oauth, /ws → :3000) # • backend — tsx watch server/src/index.ts on http://localhost:3000 # # Node 22+ is required: the backend's atproto OAuth client throws at construction on older Node. # This sources nvm and switches before launching, since `nvm` is a shell function (not on PATH in # a bare script). Both processes run under one `pnpm dev` (concurrently); Ctrl-C stops both. # # Pass SABOTAGE_DEV_SOLO=1 to let a single logged-in user create & start a game: # SABOTAGE_DEV_SOLO=1 scripts/dev.sh set -euo pipefail cd "$(dirname "$0")/.." export NVM_DIR="${NVM_DIR:-$HOME/.nvm}" if [ ! -s "$NVM_DIR/nvm.sh" ]; then echo "error: nvm not found at $NVM_DIR/nvm.sh" >&2 exit 1 fi # shellcheck disable=SC1091 . "$NVM_DIR/nvm.sh" nvm use # honors .nvmrc (Node 22) exec pnpm dev