Files
abyssVpn/deploy/scripts/package_api.ps1
T
arthur_chen f69efb67ad Initial commit: abyssVpn project
- Tauri desktop app (apps/desktop)
- Python Django API service (services/api)
- Deployment scripts and docs
2026-05-15 09:06:10 +08:00

35 lines
1.1 KiB
PowerShell

param(
[Parameter(Mandatory = $true)][string]$ProjectRoot,
[Parameter(Mandatory = $true)][string]$OutputZip
)
$ErrorActionPreference = "Stop"
$apiDir = Join-Path $ProjectRoot "services\api"
$stageRoot = Join-Path $env:TEMP ("abyssinfo-api-stage-" + [guid]::NewGuid().ToString("N"))
$stageApi = Join-Path $stageRoot "api"
New-Item -ItemType Directory -Force -Path $stageApi | Out-Null
$excludeDirs = @(".venv", "__pycache__", "staticfiles")
$excludeFiles = @("db.sqlite3")
Get-ChildItem -LiteralPath $apiDir -Force | ForEach-Object {
if ($_.PSIsContainer) {
if ($excludeDirs -notcontains $_.Name) {
Copy-Item -LiteralPath $_.FullName -Destination $stageApi -Recurse -Force
}
} elseif ($excludeFiles -notcontains $_.Name) {
Copy-Item -LiteralPath $_.FullName -Destination $stageApi -Force
}
}
if (Test-Path -LiteralPath $OutputZip) {
Remove-Item -LiteralPath $OutputZip -Force
}
Compress-Archive -Path (Join-Path $stageApi "*") -DestinationPath $OutputZip -Force
Remove-Item -LiteralPath $stageRoot -Recurse -Force
Write-Host "[AbyssInfo] Packaged API to $OutputZip"