zip time for build

This commit is contained in:
Timi
2026-10-16 18:33:03 +08:00
parent bfb868cc4b
commit 367999eb94
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
"scripts": {
"dev": "vite --host",
"build": "pnpm run type-check:publish && vite build",
"build:zip": "pnpm run build && powershell -NoProfile -Command \"New-Item -ItemType Directory -Force -Path release | Out-Null; Compress-Archive -Path dist\\* -DestinationPath release\\gao-customer-h5.zip -Force\"",
"build:zip": "pnpm run build && powershell -NoProfile -ExecutionPolicy Bypass -File scripts/build-zip.ps1",
"twa:build": "cd twa && pnpm --config.registry=https://registry.npmjs.org dlx @bubblewrap/cli@1.25.0 build --manifest=./twa-manifest.json",
"twa:update": "cd twa && pnpm --config.registry=https://registry.npmjs.org dlx @bubblewrap/cli@1.25.0 update --skipVersionUpgrade --manifest=./twa-manifest.json",
"twa:validate": "pnpm --config.registry=https://registry.npmjs.org dlx @bubblewrap/cli@1.25.0 validate --url=https://gao.imyeyu.com/",
+20
View File
@@ -0,0 +1,20 @@
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $PSScriptRoot
$releaseDirectory = Join-Path $projectRoot "release"
$distPath = Join-Path $projectRoot "dist"
New-Item -ItemType Directory -Force -Path $releaseDirectory | Out-Null
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$archiveBaseName = "gao-customer-h5-$timestamp"
$archivePath = Join-Path $releaseDirectory "$archiveBaseName.zip"
$collisionIndex = 1
while (Test-Path -LiteralPath $archivePath) {
$archivePath = Join-Path $releaseDirectory "$archiveBaseName-$collisionIndex.zip"
$collisionIndex++
}
Compress-Archive -Path (Join-Path $distPath "*") -DestinationPath $archivePath -ErrorAction Stop
Write-Output "Created archive: $archivePath"