Files
2026-06-11 17:11:28 +08:00

31 lines
1.2 KiB
PowerShell

# 离线安装 wujie 相关依赖(内网无网环境)。
# 用法:在本文件所在目录右键「使用 PowerShell 运行」,或:
# pwsh ./install-offline.ps1
#
# 依赖集(已全部打进同目录 .tgz,无其他传递依赖;vue 为已存在的 peer):
# wujie-vue3@2.0.2 -> wujie@2.0.2 -> @babel/runtime@7.29.7
$ErrorActionPreference = "Stop"
$dir = $PSScriptRoot
$proj = (Resolve-Path (Join-Path $dir "..\..")).Path
# 依赖在前、消费方在后,便于本地 tarball 互相满足 semver 范围(不触网)。
$tgz = @(
(Join-Path $dir "babel-runtime-7.29.7.tgz"),
(Join-Path $dir "wujie-2.0.2.tgz"),
(Join-Path $dir "wujie-vue3-2.0.2.tgz")
)
Push-Location $proj
try {
$hasPnpm = $null -ne (Get-Command pnpm -ErrorAction SilentlyContinue)
if ($hasPnpm) {
Write-Host "[offline] 使用 pnpm 离线安装 wujie 依赖 ..." -ForegroundColor Cyan
& pnpm add --offline @tgz
} else {
Write-Host "[offline] 未找到 pnpm,改用 npm 离线安装 ..." -ForegroundColor Cyan
& npm install --offline @tgz
}
Write-Host "[offline] 完成。可运行 'pnpm dev' / 'npm run dev' 验证。" -ForegroundColor Green
}
finally { Pop-Location }