mirror of
https://github.com/bitwarden/browser
synced 2026-02-02 17:53:41 +00:00
Allow cross-packaging Beta Appx config and release Rust libs
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env pwsh
|
||||
param(
|
||||
$CertificatePath,
|
||||
$CertificatePassword
|
||||
$CertificatePassword,
|
||||
$ElectronConfigFile="electron-builder.json",
|
||||
$Target="debug"
|
||||
)
|
||||
$ErrorActionPreference = "Stop"
|
||||
$PSNativeCommandUseErrorActionPreference = $true
|
||||
@@ -11,7 +13,7 @@ try {
|
||||
|
||||
cd $PSScriptRoot
|
||||
|
||||
$builderConfig = Get-Content electron-builder.json | ConvertFrom-Json
|
||||
$builderConfig = Get-Content $ElectronConfigFile | ConvertFrom-Json
|
||||
$packageConfig = Get-Content package.json | ConvertFrom-Json
|
||||
$manifestTemplate = Get-Content custom-appx-manifest.xml
|
||||
|
||||
@@ -20,6 +22,9 @@ $assetsDir = Get-Item $builderConfig.directories.buildResources
|
||||
$buildDir = Get-Item $builderConfig.directories.app
|
||||
$outDir = Join-Path (Get-Location) ($builderConfig.directories.output ?? "dist")
|
||||
|
||||
if ($target -eq "release") {
|
||||
$targetStr = "--release"
|
||||
}
|
||||
$arch = 'arm64'
|
||||
$ext = "appx"
|
||||
$version = Get-Date -Format "yyyy.M.d.Hmm"
|
||||
@@ -29,16 +34,21 @@ $productName = $builderConfig.productName
|
||||
$artifactName = "${productName}-$($packageConfig.version)-${arch}.$ext"
|
||||
|
||||
Write-Host "Building native code"
|
||||
npm run build-native-win-cross
|
||||
npm run build-native-win-cross -- $targetStr
|
||||
|
||||
Write-Host "Building Javascript code"
|
||||
npm run build:dev
|
||||
if ($target -eq "release") {
|
||||
npm run build
|
||||
}
|
||||
else {
|
||||
npm run build:dev
|
||||
}
|
||||
|
||||
Write-Host "Cleaning output folder"
|
||||
Remove-Item -Recurse -Force $outDir -ErrorAction Ignore
|
||||
|
||||
Write-Host "Packaging Electron executable"
|
||||
& npx electron-builder --publish never --dir --win --$arch
|
||||
& npx electron-builder --config $ElectronConfigFile --publish never --dir --win --$arch
|
||||
|
||||
cd $outDir
|
||||
New-Item -Type Directory (Join-Path $outDir "appx")
|
||||
@@ -47,16 +57,6 @@ Write-Host "Building Appx directory structure"
|
||||
$appxDir = (Join-Path $outDir appx/app)
|
||||
Move-Item (Join-Path $outDir "win-${arch}-unpacked") $appxDir
|
||||
|
||||
# # Copy native module
|
||||
# Write-Host "Copying native module"
|
||||
# $napiUnpackDir = Join-Path $outDir "appx/app/resources/app.asar.unpacked/node_modules/@bitwarden/desktop-napi/"
|
||||
# New-Item -Type Directory -Force $napiUnpackDir
|
||||
# $napiDir = Join-Path $buildDir "node_modules/`@bitwarden/desktop-napi/"
|
||||
# Push-Location $napiDir
|
||||
# Copy-Item *.node $napiUnpackDir
|
||||
# #Copy-Item index.js $napiUnpackDir
|
||||
# Pop-Location
|
||||
|
||||
Write-Host "Copying Assets"
|
||||
New-Item -Type Directory (Join-Path $outDir appx/assets)
|
||||
Copy-Item $srcDir/resources/appx/* $outDir/appx/assets/
|
||||
@@ -66,7 +66,7 @@ $translationMap = @{
|
||||
'arch' = $arch
|
||||
'applicationId' = $builderConfig.appx.applicationId
|
||||
'displayName' = $productName
|
||||
'executable' = 'app\Bitwarden.exe'
|
||||
'executable' = "app\${productName}.exe"
|
||||
'publisher' = $builderConfig.appx.publisher
|
||||
'publisherDisplayName' = $builderConfig.appx.publisherDisplayName
|
||||
'version' = $version
|
||||
|
||||
Reference in New Issue
Block a user