-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·56 lines (45 loc) · 1.34 KB
/
dev.sh
File metadata and controls
executable file
·56 lines (45 loc) · 1.34 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
#!/bin/bash
# Function to handle initialization
init() {
echo "🚀 Initializing development environment..."
# Copy .env files if they don't exist
if [ -f "backend/.env.example" ]; then
if [ ! -f "backend/.env" ]; then
echo "📝 Creating backend/.env from .env.example..."
cp backend/.env.example backend/.env
else
echo "ℹ️ backend/.env already exists, skipping copy."
fi
fi
if [ -f "frontend/.env.example" ]; then
if [ ! -f "frontend/.env" ]; then
echo "📝 Creating frontend/.env from .env.example..."
cp frontend/.env.example frontend/.env
else
echo "ℹ️ frontend/.env already exists, skipping copy."
fi
fi
# Install dependencies
echo "📦 Installing backend dependencies..."
(cd backend && npm install)
echo "📦 Installing frontend dependencies..."
(cd frontend && npm install)
echo "✅ Initialization complete!"
}
# Check for --init flag
if [[ "$1" == "--init" ]]; then
init
exit 0
fi
echo "Starting local development..."
if ! docker info > /dev/null 2>&1; then
echo "Warning: Docker is not running. Database will not be available."
else
docker-compose up -d
echo "Waiting for database to be ready..."
sleep 5
(cd backend && npx prisma generate && npx prisma migrate deploy)
fi
(cd backend && npm run dev) &
(cd frontend && npm run dev) &
wait