-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.sh
executable file
·58 lines (42 loc) · 956 Bytes
/
dev.sh
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
#!/bin/bash
export LENZ_BASE_URL="http://localhost:5173/"
PID_RUST=
PID_VITE=
FRONTEND_PATH="$(pwd)/frontend/packages/app"
SERVER_PATH="$(pwd)/agent/server"
node builder/src/plain.mjs --no-frontend --no-backend
start_frontend(){
echo "Starting frontend..."
cd frontend
echo "Starting vite project in development mode...."
pnpm dev &
PID_VITE=$!
cd ..
echo "Waiting for $LENZ_BASE_URL to be available..."
while true; do
curl -s $LENZ_BASE_URL > /dev/null
if [ $? -eq 0 ]; then
break
fi
sleep 1
done
}
start_backend(){
cd $SERVER_PATH
cargo watch -x "run" &
PID_RUST=$!
cd ..
}
start_frontend
start_backend
# Função para lidar com SIGINT (Ctrl+C)
cleanup() {
echo "\nEncerrando processos..."
kill $PID_RUST $PID_VITE
wait $PID_RUST $PID_VITE
exit 0
}
# Captura o SIGINT (Ctrl+C) e executa a função cleanup
trap cleanup SIGINT
# Aguarda os processos filhos
wait $PID_RUST $PID_VITE