-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.sh
More file actions
94 lines (75 loc) · 2.34 KB
/
Copy pathbootstrap.sh
File metadata and controls
94 lines (75 loc) · 2.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
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
#!/bin/bash
set -e
echo "🛠️ Mac Dev Starter Kit"
echo "======================="
# Check and install Xcode Command Line Tools if needed
echo "🔍 Checking for Xcode Command Line Tools..."
if ! xcode-select -p &>/dev/null; then
echo "📥 Installing Xcode Command Line Tools..."
xcode-select --install
# Wait for the installation to complete
echo "⏳ Waiting for Xcode Command Line Tools installation to complete..."
echo "⚠️ Please complete the installation prompt that appears."
echo "Press any key when the installation has completed..."
read -n 1
else
echo "✅ Xcode Command Line Tools already installed"
fi
# Check and install Homebrew if needed
echo "🔍 Checking for Homebrew..."
if ! command -v brew &>/dev/null; then
echo "📥 Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH for the current session
if [[ $(uname -m) == "arm64" ]]; then
# For Apple Silicon Macs
eval "$(/opt/homebrew/bin/brew shellenv)"
else
# For Intel Macs
eval "$(/usr/local/bin/brew shellenv)"
fi
else
echo "✅ Homebrew already installed"
fi
NVM_DIR="$HOME/.nvm"
REPO_URL="https://github.com/Varadarajan-M/mac-dev-starter-kit.git"
CLONE_DIR="$HOME/mac-dev-starter-kit"
# Step 1: Install NVM if missing
echo "🔍 Checking for NVM..."
echo
if [ ! -s "$NVM_DIR/nvm.sh" ]; then
echo "📥 Installing NVM..."
echo
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
fi
# Step 2: Load NVM
export NVM_DIR="$HOME/.nvm"
# shellcheck disable=SC1091
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
echo "✅ NVM loaded"
echo
# Step 3: Install latest LTS Node.js version if not already installed
echo "📦 Installing latest LTS Node.js..."
echo
nvm install --lts
nvm use --lts
nvm alias default 'lts/*'
echo
# Step 4: Remove existing clone and clone fresh
if [ -d "$CLONE_DIR" ]; then
echo "🗑️ Removing existing repository..."
echo
rm -rf "$CLONE_DIR"
fi
echo "📁 Cloning project repo..."
echo
git clone "$REPO_URL" "$CLONE_DIR"
cd "$CLONE_DIR"
# Step 5: Install dependencies
echo "📦 Installing npm dependencies..."
echo
npm install
# Step 6: Run the CLI
echo "🚀 Running Mac Dev Starter Kit CLI..."
echo
npx ts-node src/index.ts