-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
105 lines (87 loc) · 2.29 KB
/
setup.sh
File metadata and controls
105 lines (87 loc) · 2.29 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
#!/bin/bash
# Exit on any error
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# Function to print messages
print_message() {
echo -e "${GREEN}[INFO] $1${NC}"
}
print_error() {
echo -e "${RED}[ERROR] $1${NC}"
exit 1
}
# Check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Install Node.js (if not installed)
install_node() {
if ! command_exists node; then
print_message "Installing Node.js..."
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
else
print_message "Node.js is already installed: $(node -v)"
fi
}
# Install npm (comes with Node.js, but ensure it's available)
install_npm() {
if ! command_exists npm; then
print_error "npm not found after installing Node.js. Please install Node.js manually."
else
print_message "npm is already installed: $(npm -v)"
fi
}
# Install dfx (DFINITY Canister SDK)
install_dfx() {
if ! command_exists dfx; then
print_message "Installing dfx (DFINITY Canister SDK)..."
sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
else
print_message "dfx is already installed: $(dfx --version)"
fi
}
# Install Firebase CLI
install_firebase() {
if ! command_exists firebase; then
print_message "Installing Firebase CLI..."
npm install -g firebase-tools
else
print_message "Firebase CLI is already installed: $(firebase --version)"
fi
}
# Install project dependencies
install_project_deps() {
print_message "Installing project dependencies..."
npm install
}
# Install backend server dependencies (for Stripe)
install_server_deps() {
print_message "Installing backend server dependencies..."
cd server
npm install
cd ..
}
# Main setup function
main() {
print_message "Starting setup for nimbus.ai..."
# Install Node.js and npm
install_node
install_npm
# Install dfx
install_dfx
# Install Firebase CLI
install_firebase
# Install project dependencies
install_project_deps
# Install backend server dependencies
if [ -d "server" ]; then
install_server_deps
else
print_message "Backend server directory not found. Skipping server dependency installation."
fi
print_message "Setup complete! Follow the instructions in README.md to start the app."
}