forked from NevaMind-AI/memUBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-windows.ps1
More file actions
49 lines (41 loc) · 1.57 KB
/
Copy pathbuild-windows.ps1
File metadata and controls
49 lines (41 loc) · 1.57 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
# Windows build script for memU bot
# Usage:
# .\build-windows.ps1 # Build with default mode (memu)
param(
[string]$Mode = "memu"
)
Write-Host "Building Windows version (mode: $Mode)..." -ForegroundColor Green
# Set mirrors for Chinese network (avoid GitHub download timeouts)
$env:ELECTRON_MIRROR = "https://npmmirror.com/mirrors/electron/"
$env:ELECTRON_BUILDER_BINARIES_MIRROR = "https://npmmirror.com/mirrors/electron-builder-binaries/"
$npmCmd = Get-Command npm -ErrorAction SilentlyContinue
if (-not $npmCmd) {
Write-Host "Error: npm not found. Please install Node.js and add it to PATH." -ForegroundColor Red
Write-Host "Download: https://nodejs.org/" -ForegroundColor Yellow
exit 1
}
Write-Host "Found npm: $($npmCmd.Source)" -ForegroundColor Green
Write-Host "Node.js version:" -ForegroundColor Cyan
node --version
Write-Host "npm version:" -ForegroundColor Cyan
npm --version
if (-not (Test-Path "node_modules")) {
Write-Host "`nInstalling dependencies..." -ForegroundColor Yellow
npm install
if ($LASTEXITCODE -ne 0) {
Write-Host "Dependency install failed!" -ForegroundColor Red
exit 1
}
Write-Host "Dependencies installed." -ForegroundColor Green
} else {
Write-Host "`nnode_modules exists, skipping install" -ForegroundColor Green
}
Write-Host "`nBuilding Windows package..." -ForegroundColor Green
$env:APP_MODE = $Mode
npm run build:win
if ($LASTEXITCODE -eq 0) {
Write-Host "`nBuild succeeded! Output: dist\" -ForegroundColor Green
} else {
Write-Host "`nBuild failed!" -ForegroundColor Red
exit 1
}