Files
Alta-Proxy-Tool/build-kit.ps1
T
peji 099cc252fe Fix proxy path resolution for portable builds, simplify landing page
The proxy launch used __dirname to find aware-cam-proxy.exe, which
points to a temp extraction directory in portable builds. Added
getAppDirectory() helper that resolves the actual .exe location via
PORTABLE_EXECUTABLE_FILE. Rewrote landing page as a simple kit download
page. Added build-kit script to bundle app + proxy + extension into zip.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 19:23:48 -05:00

73 lines
2.7 KiB
PowerShell

# build-kit.ps1 — Build the Alta Proxy Tool Kit zip for distribution
# Usage: powershell -ExecutionPolicy Bypass -File build-kit.ps1
#
# Produces: dist/AltaProxyToolKit.zip containing:
# - AltaCameraProxy-<version>-portable.exe
# - aware-cam-proxy.exe
# - chrome-extension/ (folder)
$ErrorActionPreference = "Stop"
# Read version from package.json
$pkg = Get-Content "package.json" -Raw | ConvertFrom-Json
$version = $pkg.version
Write-Host "Building Alta Proxy Tool Kit v$version" -ForegroundColor Cyan
# Step 1: Build the Electron portable exe
Write-Host "`n[1/4] Building Electron app..." -ForegroundColor Yellow
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit 1
}
$portableExe = "dist\AltaCameraProxy-$version-portable.exe"
if (-not (Test-Path $portableExe)) {
Write-Host "Expected output not found: $portableExe" -ForegroundColor Red
exit 1
}
Write-Host " Built: $portableExe" -ForegroundColor Green
# Step 2: Verify aware-cam-proxy.exe exists
Write-Host "`n[2/4] Checking for aware-cam-proxy.exe..." -ForegroundColor Yellow
if (-not (Test-Path "aware-cam-proxy.exe")) {
Write-Host "aware-cam-proxy.exe not found in project root!" -ForegroundColor Red
Write-Host "Place aware-cam-proxy.exe in the project root and try again." -ForegroundColor Red
exit 1
}
Write-Host " Found: aware-cam-proxy.exe" -ForegroundColor Green
# Step 3: Verify chrome-extension folder exists
Write-Host "`n[3/4] Checking for chrome-extension/..." -ForegroundColor Yellow
if (-not (Test-Path "chrome-extension\manifest.json")) {
Write-Host "chrome-extension/ folder not found or missing manifest.json!" -ForegroundColor Red
exit 1
}
Write-Host " Found: chrome-extension/" -ForegroundColor Green
# Step 4: Create the kit zip
Write-Host "`n[4/4] Creating AltaProxyToolKit.zip..." -ForegroundColor Yellow
$kitDir = "dist\AltaProxyToolKit"
$zipPath = "dist\AltaProxyToolKit.zip"
# Clean previous kit
if (Test-Path $kitDir) { Remove-Item $kitDir -Recurse -Force }
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
# Assemble kit contents
New-Item -ItemType Directory -Path $kitDir | Out-Null
Copy-Item $portableExe "$kitDir\AltaCameraProxy.exe"
Copy-Item "aware-cam-proxy.exe" "$kitDir\aware-cam-proxy.exe"
Copy-Item "chrome-extension" "$kitDir\chrome-extension" -Recurse
# Create zip
Compress-Archive -Path "$kitDir\*" -DestinationPath $zipPath -Force
# Clean up temp directory
Remove-Item $kitDir -Recurse -Force
$zipSize = [math]::Round((Get-Item $zipPath).Length / 1MB, 1)
Write-Host "`nKit ready: $zipPath ($zipSize MB)" -ForegroundColor Green
Write-Host "Upload this file as a release asset named 'AltaProxyToolKit.zip'" -ForegroundColor Cyan