-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart
More file actions
executable file
·46 lines (37 loc) · 1.19 KB
/
start
File metadata and controls
executable file
·46 lines (37 loc) · 1.19 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
#!/bin/sh
cleanup() {
echo "Cleaning up..."
pkill -P $$
exit 0
}
trap cleanup SIGINT EXIT
if [ "$1" = "prod" ]; then
echo "Starting in production mode..."
cd frontend
npm run build
npm run start &
cd ../backend/byteport
go run main.go
elif [ "$1" = "dev" ]; then
echo "Starting in development mode..."
# Check if tmux is installed
if ! command -v tmux > /dev/null; then
echo "tmux is not installed. Please install tmux to use this script."
exit 1
fi
# Start a new tmux session named 'devsession' and detach
tmux new-session -d -s devsession
# Split the window vertically (-v) or horizontally (-h)
tmux split-window -h
# In the first pane (pane 0), start the frontend
tmux select-pane -t 0
tmux send-keys 'cd /Users/kooshapari/temp-PRODVERCEL/Rust/webApp/byte_port/frontend && npm run dev -- --port 5173' C-m
# In the second pane (pane 1), start the backend
tmux select-pane -t 1
tmux send-keys 'cd /Users/kooshapari/temp-PRODVERCEL/Rust/webApp/byte_port/backend/byteport && air' C-m
# Attach to the tmux session
tmux attach-session -t devsession
else
echo "Usage: $0 {dev|prod}"
exit 1
fi