@@ -114,10 +114,63 @@ $nodeVersion = node -v
114114$npmVersion = npm - v
115115Write-ColorOutput Green " ✅ Node.js $nodeVersion and npm $npmVersion detected"
116116
117- # Install CLI globally
117+ # Check if git is available
118+ if (-not (Test-CommandExists " git" )) {
119+ Write-ColorOutput Red " ❌ Git is required but not found."
120+ Write-ColorOutput Yellow " Please install Git and run this script again."
121+ Write-ColorOutput Cyan " https://git-scm.com/downloads"
122+ exit 1
123+ }
124+
125+ # Install CLI globally from GitHub
118126Write-Output " "
119- Write-ColorOutput Cyan " 📦 Installing DesterLib CLI..."
120- npm install - g @desterlib / cli@latest
127+ Write-ColorOutput Cyan " 📦 Installing DesterLib CLI from GitHub..."
128+
129+ # Create temporary directory
130+ $TempDir = New-TemporaryFile | ForEach-Object { Remove-Item $_ ; New-Item - ItemType Directory - Path $_ }
131+
132+ try {
133+ # Clone repository
134+ Write-ColorOutput Cyan " Cloning repository..."
135+ $cloneResult = git clone -- depth 1 -- branch main https:// github.com / DesterLib/ desterlib.git " $TempDir \desterlib" 2>&1
136+ if ($LASTEXITCODE -ne 0 ) {
137+ Write-ColorOutput Red " ❌ Failed to clone repository."
138+ exit 1
139+ }
140+
141+ # Navigate to CLI package and install
142+ Push-Location " $TempDir \desterlib\packages\cli"
143+
144+ # Install dependencies and build
145+ Write-ColorOutput Cyan " Building CLI..."
146+ npm install
147+ if ($LASTEXITCODE -ne 0 ) {
148+ Write-ColorOutput Red " ❌ Failed to install dependencies."
149+ exit 1
150+ }
151+
152+ npm run build
153+ if ($LASTEXITCODE -ne 0 ) {
154+ Write-ColorOutput Red " ❌ Failed to build CLI."
155+ exit 1
156+ }
157+
158+ # Install globally
159+ Write-ColorOutput Cyan " Installing CLI globally..."
160+ npm install - g .
161+ if ($LASTEXITCODE -ne 0 ) {
162+ Write-ColorOutput Red " ❌ Failed to install CLI globally."
163+ exit 1
164+ }
165+
166+ Pop-Location
167+ } catch {
168+ Write-ColorOutput Red " ❌ Error during installation: $_ "
169+ exit 1
170+ } finally {
171+ # Clean up
172+ Remove-Item - Recurse - Force $TempDir - ErrorAction SilentlyContinue
173+ }
121174
122175# Verify installation
123176if (Test-CommandExists " desterlib" ) {
0 commit comments