Download start.sh from NAP1320/RotNot: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/NAP1320/RotNot/resolve/main/start.sh
- Command line
-
hf download hf://spaces/NAP1320/RotNot/start.sh
-
curl -L -o start.sh https://huggingface.co/spaces/NAP1320/RotNot/resolve/main/start.sh
1.29 kB
| # Launch the RotNot dev server (Next.js handles both frontend + API routes in one process) | |
| # and open the browser once it's ready. Override the port with PORT=3101 ./start.sh | |
| set -euo pipefail | |
| cd "$(dirname "$0")" | |
| PORT="${PORT:-3000}" | |
| URL="http://localhost:${PORT}" | |
| if [ ! -f .env ] && [ -f .env.example ]; then | |
| echo "warning: no .env found — copy .env.example to .env and add ANTHROPIC_API_KEY before exercises will work" | |
| fi | |
| if [ ! -d node_modules ]; then | |
| echo "installing dependencies..." | |
| npm install | |
| fi | |
| if [ ! -f dev.db ]; then | |
| echo "no dev.db found — running prisma migrate deploy + seed..." | |
| npx prisma migrate deploy | |
| npx prisma db seed | |
| fi | |
| cleanup() { | |
| if [ -n "${DEV_PID:-}" ] && kill -0 "$DEV_PID" 2>/dev/null; then | |
| kill "$DEV_PID" 2>/dev/null || true | |
| fi | |
| } | |
| trap cleanup EXIT INT TERM | |
| echo "starting next dev on port ${PORT}..." | |
| PORT="$PORT" npm run dev & | |
| DEV_PID=$! | |
| echo "waiting for ${URL} to respond..." | |
| for _ in $(seq 1 60); do | |
| if curl -sf -o /dev/null "$URL"; then | |
| echo "server is up — opening browser" | |
| case "$(uname -s)" in | |
| Darwin) open "$URL" ;; | |
| Linux) xdg-open "$URL" >/dev/null 2>&1 || true ;; | |
| MINGW*|MSYS*|CYGWIN*) start "$URL" ;; | |
| esac | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| wait "$DEV_PID" | |