2019-08-26 20:26:23 +02:00
|
|
|
|
param (
|
2019-10-01 23:29:52 +02:00
|
|
|
|
[string] $version,
|
|
|
|
|
[switch] $mas
|
2019-08-26 20:26:23 +02:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Dependencies:
|
|
|
|
|
# 1. brew cask install powershell
|
|
|
|
|
#
|
|
|
|
|
# To run:
|
|
|
|
|
# pwsh ./build-safari-appex.ps1 -version 1.41.0
|
|
|
|
|
|
|
|
|
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
|
|
|
|
$rootDir = $dir + "\..";
|
|
|
|
|
$distDir = $rootDir + "\dist";
|
|
|
|
|
$distSafariDir = $distDir + "\safari";
|
2019-10-01 23:29:52 +02:00
|
|
|
|
$distSafariAppexDmg = $distSafariDir + "\browser\dist\Safari\dmg\build\Release\safari.appex";
|
|
|
|
|
$distSafariAppexMas = $distSafariDir + "\browser\dist\Safari\mas\build\Release\safari.appex";
|
2019-08-26 20:26:23 +02:00
|
|
|
|
$pluginsAppex = $rootDir + "\PlugIns\safari.appex";
|
|
|
|
|
|
2019-08-26 21:24:25 +02:00
|
|
|
|
if(Test-Path -Path $distSafariDir) {
|
|
|
|
|
Remove-Item -Recurse -Force $distSafariDir
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(Test-Path -Path $pluginsAppex) {
|
|
|
|
|
Remove-Item -Recurse -Force $pluginsAppex
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-26 20:27:43 +02:00
|
|
|
|
New-Item $distSafariDir -ItemType Directory -ea 0
|
2019-08-26 20:26:23 +02:00
|
|
|
|
cd $distSafariDir
|
2019-08-26 21:24:25 +02:00
|
|
|
|
git clone git@github.com:bitwarden/browser.git
|
2019-08-26 20:26:23 +02:00
|
|
|
|
cd browser
|
2019-08-26 21:24:25 +02:00
|
|
|
|
|
2019-09-10 21:16:56 +02:00
|
|
|
|
if(-not ([string]::IsNullOrEmpty($version))) {
|
2019-08-26 21:24:25 +02:00
|
|
|
|
$tag = "v" + $version
|
|
|
|
|
git checkout tags/$tag
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-26 20:26:23 +02:00
|
|
|
|
npm i
|
|
|
|
|
npm run dist:safari
|
2019-10-01 23:29:52 +02:00
|
|
|
|
if($mas) {
|
|
|
|
|
Copy-Item -Path $distSafariAppexMas -Destination $pluginsAppex –Recurse
|
|
|
|
|
} else {
|
|
|
|
|
Copy-Item -Path $distSafariAppexDmg -Destination $pluginsAppex –Recurse
|
|
|
|
|
}
|
2019-08-26 20:26:23 +02:00
|
|
|
|
cd $rootDir
|