Archived
40 lines
1.2 KiB
PowerShell
40 lines
1.2 KiB
PowerShell
param(
|
||
[ValidateSet('x64', 'ia32')]
|
||
[string]$Arch = 'x64'
|
||
)
|
||
|
||
$ErrorActionPreference = 'Stop'
|
||
$desktop = Split-Path -Parent $PSScriptRoot
|
||
Set-Location $desktop
|
||
|
||
if (-not $env:ELECTRON_MIRROR) {
|
||
$env:ELECTRON_MIRROR = 'https://npmmirror.com/mirrors/electron/'
|
||
}
|
||
if (-not $env:ELECTRON_BUILDER_BINARIES_MIRROR) {
|
||
$env:ELECTRON_BUILDER_BINARIES_MIRROR = 'https://npmmirror.com/mirrors/electron-builder-binaries/'
|
||
}
|
||
$env:CSC_IDENTITY_AUTO_DISCOVERY = 'false'
|
||
|
||
if ($Arch -eq 'ia32') {
|
||
& (Join-Path $PSScriptRoot 'prepare-ia32.ps1')
|
||
$electronDist = 'node_modules/electron-ia32/dist'
|
||
$outDir = 'release/win-ia32-unpacked'
|
||
} else {
|
||
$electronDist = 'node_modules/electron/dist'
|
||
$outDir = 'release/win-unpacked'
|
||
}
|
||
|
||
Write-Host "Building unpacked app ($Arch)..."
|
||
& .\node_modules\.bin\electron-builder.cmd --win --$Arch --dir --config.electronDist=$electronDist
|
||
|
||
$exe = Join-Path $outDir 'FMCRAFT Chat Desktop.exe'
|
||
if (!(Test-Path $exe)) {
|
||
throw "未找到打包后的 exe:$exe"
|
||
}
|
||
node scripts\brand-exe.mjs $exe
|
||
|
||
Write-Host "Building portable exe ($Arch)..."
|
||
& .\node_modules\.bin\electron-builder.cmd --win portable --$Arch --prepackaged $outDir
|
||
|
||
Write-Host "Done: release\FMCRAFT-Chat-1.0.0-$Arch.exe"
|