-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall.ps1
More file actions
82 lines (67 loc) · 2.25 KB
/
Copy pathinstall.ps1
File metadata and controls
82 lines (67 loc) · 2.25 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
# ShipNode Installation Script for Windows (PowerShell)
# Usage: irm https://raw.githubusercontent.com/devalade/shipnode-v2/main/install.ps1 | iex
param(
[string]$Version = "latest"
)
$ErrorActionPreference = "Stop"
Write-Host "ShipNode Installer" -ForegroundColor Green
Write-Host ""
# Check for Node.js
$NodePath = Get-Command node -ErrorAction SilentlyContinue
if (-not $NodePath) {
Write-Host "Error: Node.js is not installed." -ForegroundColor Red
Write-Host "ShipNode requires Node.js >= 18."
Write-Host ""
Write-Host "Download from: https://nodejs.org/"
exit 1
}
$NodeVersion = (node --version).Substring(1)
$RequiredVersion = [Version]"18.0.0"
$CurrentVersion = [Version]$NodeVersion
if ($CurrentVersion -lt $RequiredVersion) {
Write-Host "Error: Node.js $NodeVersion is too old." -ForegroundColor Red
Write-Host "ShipNode requires Node.js >= 18."
exit 1
}
Write-Host "Node.js: $NodeVersion " -NoNewline
Write-Host "✓" -ForegroundColor Green
# Check for npm
$NpmPath = Get-Command npm -ErrorAction SilentlyContinue
if (-not $NpmPath) {
Write-Host "Error: npm is not installed." -ForegroundColor Red
exit 1
}
Write-Host "npm: $(npm --version) " -NoNewline
Write-Host "✓" -ForegroundColor Green
Write-Host ""
# Install ShipNode
Write-Host "Installing ShipNode via npm..." -ForegroundColor Green
if ($Version -eq "latest") {
npm install -g shipnode
} else {
npm install -g "shipnode@$Version"
}
# Verify installation
$ShipnodePath = Get-Command shipnode -ErrorAction SilentlyContinue
if ($ShipnodePath) {
Write-Host ""
Write-Host "✓ ShipNode installed successfully!" -ForegroundColor Green
Write-Host ""
try {
& shipnode --version
} catch {
Write-Host " shipnode installed"
}
Write-Host ""
Write-Host "Quick start:"
Write-Host " shipnode init # Create shipnode.config.ts"
Write-Host " shipnode setup # Prepare your server"
Write-Host " shipnode deploy # Deploy your app"
Write-Host ""
Write-Host "Run 'shipnode help' for all commands."
} else {
Write-Host ""
Write-Host "⚠ Installation completed, but 'shipnode' is not in your PATH." -ForegroundColor Yellow
Write-Host ""
Write-Host "Restart your terminal and try again."
}