diff --git a/apps/browser/package.json b/apps/browser/package.json index f48b78d5bb..ed0a8d3634 100644 --- a/apps/browser/package.json +++ b/apps/browser/package.json @@ -19,10 +19,10 @@ "build:prod:firefox": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:firefox", "build:prod:opera": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:opera", "build:prod:safari": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:safari", - "dist:chrome": "npm run build:prod:chrome && mkdir -p dist && tar -C ./build -acf dist/dist-chrome.zip ./", - "dist:edge": "npm run build:prod:edge && mkdir -p dist && tar -C ./build -acf dist/dist-edge.zip ./", - "dist:firefox": "npm run build:prod:firefox && mkdir -p dist && tar -C ./build -acf dist/dist-firefox.zip ./", - "dist:opera": "npm run build:prod:opera && mkdir -p dist && tar -C ./build -acf dist/dist-opera.zip ./", + "dist:chrome": "npm run build:prod:chrome && mkdir -p dist && ./scripts/compress.ps1 dist-chrome.zip", + "dist:edge": "npm run build:prod:edge && mkdir -p dist && ./scripts/compress.ps1 dist-edge.zip", + "dist:firefox": "npm run build:prod:firefox && mkdir -p dist && ./scripts/compress.ps1 dist-firefox.zip", + "dist:opera": "npm run build:prod:opera && mkdir -p dist && ./scripts/compress.ps1 dist-opera.zip", "dist:safari": "npm run build:prod:safari && ./scripts/package-safari.ps1", "dist:edge:mv3": "cross-env MANIFEST_VERSION=3 npm run dist:edge", "dist:firefox:mv3": "cross-env MANIFEST_VERSION=3 npm run dist:firefox", diff --git a/apps/browser/scripts/compress.ps1 b/apps/browser/scripts/compress.ps1 new file mode 100755 index 0000000000..981a07c3c8 --- /dev/null +++ b/apps/browser/scripts/compress.ps1 @@ -0,0 +1,30 @@ +#!/usr/bin/env pwsh + +#### +# Compress the build directory into a zip file. +#### + +param ( + [Parameter(Mandatory = $true)] + [String] $fileName +) + +$buildDir = Join-Path $PSScriptRoot "../build" +$distDir = Join-Path $PSScriptRoot "../dist" + +# Create dist directory if it doesn't exist +if (-not (Test-Path $distDir)) { + New-Item -ItemType Directory -Path $distDir +} + +$distPath = Join-Path -Path $distDir -ChildPath $fileName + +if (Test-Path $distPath) { + Remove-Item $distPath +} + +# Compress build directory +if (Test-Path $buildDir) { + Compress-Archive -Path (Join-Path $buildDir "*") -DestinationPath $distPath + Write-Output "Zipped $buildDir into $distPath" +}