-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
54 lines (30 loc) · 926 Bytes
/
Copy pathinstall.ps1
File metadata and controls
54 lines (30 loc) · 926 Bytes
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
$ErrorActionPreference = "Stop"
$REPO = "GhanshyamSharma122/codecli"
$BRANCH = "main"
$APP = "codecli"
$INSTALL_DIR = "$env:USERPROFILE\.$APP"
Write-Host "Installing $APP..."
# Check Node
if (!(Get-Command node -ErrorAction SilentlyContinue)) {
Write-Error "NodeJS not installed https://nodejs.org"
exit 1
}
New-Item -ItemType Directory -Force -Path $INSTALL_DIR | Out-Null
$ZIP = "$INSTALL_DIR\repo.zip"
Write-Host "Downloading..."
Invoke-WebRequest `
"https://github.com/$REPO/archive/refs/heads/$BRANCH.zip" `
-OutFile $ZIP
Write-Host "Extracting..."
Expand-Archive $ZIP -DestinationPath $INSTALL_DIR -Force
$FOLDER = Get-ChildItem $INSTALL_DIR |
Where-Object { $_.PSIsContainer } |
Select-Object -First 1
Set-Location $FOLDER.FullName
Write-Host "Installing dependencies..."
npm install
Write-Host "Linking globally..."
npm link
Write-Host ""
Write-Host "SUCCESS!"
Write-Host "Run: codecli"