-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.ps1
More file actions
50 lines (42 loc) · 1.75 KB
/
install.ps1
File metadata and controls
50 lines (42 loc) · 1.75 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
# Copilot Hub - Windows 安装脚本
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Copilot Hub - Windows 安装" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# 安装 Python
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Host "[1/4] 安装 Python..." -ForegroundColor Green
$pythonUrl = "https://www.python.org/ftp/python/3.12.0/python-3.12.0-amd64.exe"
$installer = "$env:TEMP\python-installer.exe"
Invoke-WebRequest -Uri $pythonUrl -OutFile $installer
Start-Process -FilePath $installer -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait
Remove-Item $installer -Force
}
# 安装 uv
if (-not (Get-Command uv -ErrorAction SilentlyContinue)) {
Write-Host "[2/4] 安装 uv..." -ForegroundColor Green
powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"
}
# 安装 Node.js
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
Write-Host "[3/4] 安装 Node.js..." -ForegroundColor Green
$nodeUrl = "https://nodejs.org/dist/v20.11.0/node-v20.11.0-x64.msi"
$installer = "$env:TEMP\node-installer.msi"
Invoke-WebRequest -Uri $nodeUrl -OutFile $installer
Start-Process -FilePath $installer -ArgumentList "/quiet" -Wait
Remove-Item $installer -Force
}
# 安装依赖
Write-Host "[4/4] 安装项目依赖..." -ForegroundColor Green
Set-Location $PSScriptRoot
uv sync --quiet
Set-Location frontend
if (Get-Command pnpm -ErrorAction SilentlyContinue) {
pnpm install --silent
} else {
npm install --prefer-offline --silent
}
pnpm run build
Write-Host ""
Write-Host "安装完成!运行 cmd /c start.bat 启动服务" -ForegroundColor Green