-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtauri-dev-debug.sh
More file actions
59 lines (48 loc) · 1.63 KB
/
Copy pathtauri-dev-debug.sh
File metadata and controls
59 lines (48 loc) · 1.63 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Enable GBBox debug logging in the backend (checked by init_debug_mode in lib.rs)
export GAMEBASEBOX_DEBUG=1
# Ensure Cargo/Rust binaries added by Rustup are available in this shell session
export PATH="$HOME/.cargo/bin:$PATH"
# Check for node_modules in a clean clone
if [ ! -d "node_modules" ]; then
echo "[GBBox] ERROR: node_modules folder not found."
echo "[GBBox] Please run 'npm install' before starting the development server."
exit 1
fi
echo "[GBBox] Using Rust:"
rustc --version
cargo --version
frontend_ready() {
curl -fsS --max-time 2 http://127.0.0.1:3000/ >/dev/null 2>&1
}
FRONTEND_PID=""
if ! frontend_ready; then
if lsof -i :3000 -t >/dev/null 2>&1; then
echo "[GBBox] ERROR: A process is listening on port 3000 but is not serving the frontend."
echo "[GBBox] Close the stale frontend process, then run this launcher again."
exit 1
fi
echo "[GBBox] Frontend is not running."
echo "[GBBox] Launching 'npm run dev' in the background..."
npm run dev &
FRONTEND_PID=$!
fi
for attempt in $(seq 1 30); do
if frontend_ready; then
break
fi
sleep 1
done
if ! frontend_ready; then
echo "[GBBox] ERROR: Frontend did not become ready at http://127.0.0.1:3000 within 30 seconds."
if [ -n "$FRONTEND_PID" ]; then
kill "$FRONTEND_PID" 2>/dev/null
fi
exit 1
fi
echo "[GBBox] Starting Tauri in debug mode (GAMEBASEBOX_DEBUG=1)..."
npx tauri dev --no-dev-server-wait --config tauri.dev-override.json
# If we started the frontend in this script, clean it up when we exit
if [ -n "$FRONTEND_PID" ]; then
kill "$FRONTEND_PID" 2>/dev/null
fi