-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·127 lines (103 loc) · 2.53 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·127 lines (103 loc) · 2.53 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
set -e
# DevBoard Setup Script
# Sets up both backend and frontend development environments
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Parse arguments
SKIP_MIGRATIONS=false
while [[ $# -gt 0 ]]; do
case $1 in
--skip-migrations)
SKIP_MIGRATIONS=true
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--skip-migrations]"
exit 1
;;
esac
done
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
error() {
echo -e "${RED}[ERROR]${NC} $1"
exit 1
}
check_command() {
if ! command -v "$1" &> /dev/null; then
error "$1 is required but not installed. Please install it first."
fi
}
install_node() {
if command -v brew &> /dev/null; then
info "Installing node via Homebrew..."
brew install node
else
error "node is not installed and Homebrew is not available. Please install node manually."
fi
}
install_pnpm() {
info "Installing pnpm via npm..."
npm install -g pnpm
}
install_uv() {
if command -v brew &> /dev/null; then
info "Installing uv via Homebrew..."
brew install uv
else
info "Installing uv via installer script..."
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
fi
}
# Check prerequisites
info "Checking prerequisites..."
if ! command -v node &> /dev/null; then
warn "node not found, attempting to install..."
install_node
fi
if ! command -v pnpm &> /dev/null; then
warn "pnpm not found, attempting to install..."
install_pnpm
fi
if ! command -v uv &> /dev/null; then
warn "uv not found, attempting to install..."
install_uv
fi
brew install tree
info "All prerequisites satisfied"
# Backend setup
info "Setting up backend..."
cd "$SCRIPT_DIR/backend"
info "Installing backend dependencies..."
make install
if [ "$SKIP_MIGRATIONS" = false ]; then
info "Running database migrations..."
make migrate
else
warn "Skipping database migrations (--skip-migrations flag set)"
fi
info "Backend setup complete"
# Frontend setup
info "Setting up frontend..."
cd "$SCRIPT_DIR/frontend"
info "Installing frontend dependencies..."
pnpm install
info "Frontend setup complete"
# Summary
echo ""
info "Setup complete!"
echo ""
echo "To start the development servers, run:"
echo ""
echo " ./start.sh"