-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstart.command
More file actions
executable file
·44 lines (37 loc) · 1.69 KB
/
Copy pathstart.command
File metadata and controls
executable file
·44 lines (37 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# Double-click this file in Finder to start the app (macOS).
# On first run: right-click → Open → Open (to bypass Gatekeeper).
# Move to the folder where this script lives, regardless of where it was launched from
cd "$(dirname "$0")"
# ── Check Node.js ──────────────────────────────────────────────────────────────
if ! command -v node &>/dev/null; then
osascript -e 'display alert "Node.js not found" message "Install Node.js 18+ from https://nodejs.org then double-click start.command again." buttons {"OK"} default button "OK"'
exit 1
fi
# ── Install dependencies if node_modules is missing ───────────────────────────
if [ ! -d "node_modules" ]; then
osascript -e 'display notification "Installing dependencies, please wait…" with title "BBox Editor"'
npm install
fi
# ── Start Ollama in background if installed but not running ───────────────────
if command -v ollama &>/dev/null; then
if ! curl -sf http://localhost:11434/api/tags &>/dev/null; then
echo "Starting Ollama in background…"
ollama serve &>/dev/null &
disown
sleep 1
fi
fi
# ── Start dev server in background, then open browser once it's ready ─────────
npm run dev &
SERVER_PID=$!
echo "Waiting for server to be ready…"
for i in $(seq 1 30); do
if curl -sf http://localhost:5173 &>/dev/null; then
open http://localhost:5173
break
fi
sleep 0.5
done
# Keep terminal open so the server keeps running; Ctrl+C to stop
wait $SERVER_PID