@cannbot-ai/install-helper 0.0.2-beta.72 → 0.0.2-beta.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/install.ps1 +8 -58
- package/package.json +6 -6
package/dist/install.ps1
CHANGED
|
@@ -22,7 +22,7 @@ trap {
|
|
|
22
22
|
Write-Host ""
|
|
23
23
|
Write-Host " Press Enter to exit..."
|
|
24
24
|
Read-Host
|
|
25
|
-
|
|
25
|
+
return
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function Compare-SemVer($a, $b) {
|
|
@@ -47,57 +47,7 @@ Write-Host ""
|
|
|
47
47
|
Write-Host " CANNBot Install Helper" -ForegroundColor Cyan
|
|
48
48
|
Write-Host ""
|
|
49
49
|
|
|
50
|
-
# 1.
|
|
51
|
-
$hasNode = $false
|
|
52
|
-
try {
|
|
53
|
-
$nodeVersion = & node --version 2>$null
|
|
54
|
-
if ($nodeVersion) {
|
|
55
|
-
$majorVersion = [int]($nodeVersion -replace '^v', '' -replace '\..*', '')
|
|
56
|
-
if ($majorVersion -ge 18) {
|
|
57
|
-
$hasNode = $true
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
} catch {}
|
|
61
|
-
|
|
62
|
-
if ($hasNode) {
|
|
63
|
-
Write-Host " [OK] Node.js $nodeVersion" -ForegroundColor Green
|
|
64
|
-
Write-Host ""
|
|
65
|
-
|
|
66
|
-
# Check if already installed
|
|
67
|
-
try {
|
|
68
|
-
$installedVersion = & install-helper --version 2>$null
|
|
69
|
-
if ($installedVersion) {
|
|
70
|
-
Write-Host " [OK] 检测到已安装 install-helper (版本: $installedVersion)" -ForegroundColor Yellow
|
|
71
|
-
}
|
|
72
|
-
} catch {}
|
|
73
|
-
|
|
74
|
-
Write-Host " Installing @cannbot-ai/install-helper..." -ForegroundColor Cyan
|
|
75
|
-
Write-Host ""
|
|
76
|
-
|
|
77
|
-
$prevEAP = $ErrorActionPreference
|
|
78
|
-
$ErrorActionPreference = "Continue"
|
|
79
|
-
& npm.cmd install -g @cannbot-ai/install-helper
|
|
80
|
-
$npmExit = $LASTEXITCODE
|
|
81
|
-
$ErrorActionPreference = $prevEAP
|
|
82
|
-
if ($npmExit -eq 0) {
|
|
83
|
-
Write-Host ""
|
|
84
|
-
Write-Host " [OK] 安装成功!" -ForegroundColor Green
|
|
85
|
-
Write-Host ""
|
|
86
|
-
Write-Host " 请运行: install-helper" -ForegroundColor Cyan
|
|
87
|
-
exit 0
|
|
88
|
-
} else {
|
|
89
|
-
Write-Host ""
|
|
90
|
-
Write-Host " [ERROR] npm 安装失败" -ForegroundColor Red
|
|
91
|
-
Write-Host ""
|
|
92
|
-
Write-Host " 请尝试以管理员权限运行:"
|
|
93
|
-
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
94
|
-
exit 1
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
# 2. Path B: No Node.js — download prebuilt binary
|
|
99
|
-
|
|
100
|
-
# Detect platform
|
|
50
|
+
# 1. Detect platform
|
|
101
51
|
$Arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "x64" }
|
|
102
52
|
$SubPkgName = "@cannbot-ai/install-helper-windows-$Arch"
|
|
103
53
|
$BinaryName = "install-helper.exe"
|
|
@@ -148,7 +98,7 @@ if (-not $Version) {
|
|
|
148
98
|
Write-Host ""
|
|
149
99
|
Write-Host " Alternative (requires Node.js 18+):"
|
|
150
100
|
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
151
|
-
|
|
101
|
+
return
|
|
152
102
|
}
|
|
153
103
|
|
|
154
104
|
# 3. Download tarball (with mirror fallback)
|
|
@@ -180,7 +130,7 @@ if (-not $Downloaded) {
|
|
|
180
130
|
Write-Host ""
|
|
181
131
|
Write-Host " Alternative (requires Node.js 18+):"
|
|
182
132
|
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
183
|
-
|
|
133
|
+
return
|
|
184
134
|
}
|
|
185
135
|
|
|
186
136
|
# 4. Extract
|
|
@@ -190,7 +140,7 @@ $TempExtract = Join-Path $env:TEMP "ih-extract-$(Get-Random)"
|
|
|
190
140
|
New-Item -ItemType Directory -Force -Path $TempExtract | Out-Null
|
|
191
141
|
|
|
192
142
|
try {
|
|
193
|
-
& tar xzf $TempFile -C $TempExtract 2
|
|
143
|
+
& tar xzf $TempFile -C $TempExtract 2>$null
|
|
194
144
|
if ($LASTEXITCODE -ne 0) {
|
|
195
145
|
throw "tar exit code $LASTEXITCODE"
|
|
196
146
|
}
|
|
@@ -199,7 +149,7 @@ try {
|
|
|
199
149
|
Write-Host " Windows 10 1803+ includes tar. For older Windows, use npm install."
|
|
200
150
|
Remove-Item $TempExtract -Recurse -Force -ErrorAction SilentlyContinue
|
|
201
151
|
Remove-Item $TempFile -Force -ErrorAction SilentlyContinue
|
|
202
|
-
|
|
152
|
+
return
|
|
203
153
|
}
|
|
204
154
|
|
|
205
155
|
$BinarySrc = Join-Path $TempExtract "package\$BinaryName"
|
|
@@ -209,7 +159,7 @@ if (-not (Test-Path $BinarySrc)) {
|
|
|
209
159
|
Write-Host " [ERROR] Binary not found in tarball: $BinarySrc" -ForegroundColor Red
|
|
210
160
|
Remove-Item $TempExtract -Recurse -Force -ErrorAction SilentlyContinue
|
|
211
161
|
Remove-Item $TempFile -Force -ErrorAction SilentlyContinue
|
|
212
|
-
|
|
162
|
+
return
|
|
213
163
|
}
|
|
214
164
|
|
|
215
165
|
Copy-Item $BinarySrc $BinaryDest -Force
|
|
@@ -233,7 +183,7 @@ if (-not $UserPath) {
|
|
|
233
183
|
|
|
234
184
|
# 6. Verify binary and launch
|
|
235
185
|
try {
|
|
236
|
-
$null = & $BinaryDest --version 2
|
|
186
|
+
$null = & $BinaryDest --version 2>$null
|
|
237
187
|
Write-Host " Launching install-helper..." -ForegroundColor Cyan
|
|
238
188
|
Write-Host ""
|
|
239
189
|
& $BinaryDest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cannbot-ai/install-helper",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.74",
|
|
4
4
|
"description": "Install Helper - Interactive installer for CANN operator development skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"yaml": "^2.6.0"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@cannbot-ai/install-helper-linux-x64": "0.0.2-beta.
|
|
46
|
-
"@cannbot-ai/install-helper-linux-arm64": "0.0.2-beta.
|
|
47
|
-
"@cannbot-ai/install-helper-darwin-x64": "0.0.2-beta.
|
|
48
|
-
"@cannbot-ai/install-helper-darwin-arm64": "0.0.2-beta.
|
|
49
|
-
"@cannbot-ai/install-helper-windows-x64": "0.0.2-beta.
|
|
45
|
+
"@cannbot-ai/install-helper-linux-x64": "0.0.2-beta.74",
|
|
46
|
+
"@cannbot-ai/install-helper-linux-arm64": "0.0.2-beta.74",
|
|
47
|
+
"@cannbot-ai/install-helper-darwin-x64": "0.0.2-beta.74",
|
|
48
|
+
"@cannbot-ai/install-helper-darwin-arm64": "0.0.2-beta.74",
|
|
49
|
+
"@cannbot-ai/install-helper-windows-x64": "0.0.2-beta.74"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.0.0",
|