-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·41 lines (33 loc) · 884 Bytes
/
dev.sh
File metadata and controls
executable file
·41 lines (33 loc) · 884 Bytes
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
#!/bin/bash
echo "Initiating dev setup with local PostgreSQL instance..."
# Auto-detect compose command
if command -v podman-compose &> /dev/null; then
COMPOSE_CMD="podman-compose"
elif command -v docker-compose &> /dev/null; then
COMPOSE_CMD="docker-compose"
else
echo "Error: Neither podman-compose nor docker-compose found!"
exit 1
fi
echo "Using: $COMPOSE_CMD"
# Start PostgreSQL
echo "Starting PostgreSQL..."
$COMPOSE_CMD up -d
# Determine which dev command to run based on parameters
if [ -n "$1" ]; then
DEV_CMD="dev:$1"
echo "Starting $1 development server..."
else
DEV_CMD="dev"
echo "Starting all development servers..."
fi
# Start the development server
pnpm $DEV_CMD
# Cleanup function
cleanup() {
echo "Shutting down..."
$COMPOSE_CMD down
exit 0
}
# Trap cleanup function on script exit
trap cleanup SIGINT SIGTERM EXIT