1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00

Switch to using PowerShell for compressing (#12052)

This commit is contained in:
Oscar Hinton 2024-11-19 17:25:35 +01:00 committed by GitHub
parent 21855595c5
commit 0386b7f068
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 4 deletions

View File

@ -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",

View File

@ -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"
}