Skip to content

Commit

Permalink
Update powershell scripts to match bash build scripts (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilraojl authored Apr 18, 2024
1 parent a5e5cf4 commit 5313dc2
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 19 deletions.
46 changes: 46 additions & 0 deletions scripts/build-dev.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
param(
[string]$browser
)

$currPwd = Get-Location

Set-Location $currPwd
Write-Output "Moved to scripts dir"

if ($browser -eq "chrome")
{
Write-Output "Build chrome extension"
} else
{
Write-Output "Build firefox extension"
}


if (Test-Path -path "../build")
{
$null = Remove-Item "../build" -recurse -erroraction stop
Write-Output "Removed build dir"
}

mkdir ../build
Write-Output "Created build dir"

Copy-Item "../src/*" -destination "../build" -recurse -erroraction stop
Write-Output "Copied Sources"

Set-Location ..
#build-vuecomp
& "$PSScriptRoot\build-vue-comp.ps1"
Write-Output "Built vue components"

Set-Location scripts
if ($browser -eq "chrome")
{
Copy-Item "../addon/chrome/*" -destination "../build" -recurse -erroraction stop
} else
{
Copy-Item "../addon/firefox/*" -destination "../build" -recurse -erroraction stop
}
Write-Output "Copied webextension files"

Write-Output "Done!"
63 changes: 44 additions & 19 deletions scripts/build-unsigned.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
param (
[string]$browser
)

$currPwd = Get-Location

if (!(Test-Path -path "../dist")) {
if (!(Test-Path -path "../dist"))
{
$null = mkdir "../dist"
}

if (Test-Path -path "../dist/resting.xpi") {
if (Test-Path -path "../dist/resting.xpi")
{
$null = Remove-Item "../dist/resting.xpi"
}

if (Test-Path -path "../dist/resting-unsigned.xpi") {
if (Test-Path -path "../dist/resting-unsigned.xpi")
{
$null = Remove-Item "../dist/resting-unsigned.xpi"
}

Expand All @@ -17,26 +24,40 @@ cd ..
& "$PSScriptRoot\build-vue-comp.ps1"
echo "vue components built"

cd "src"
if (!(Test-Path -path "dist/tmp"))
{
$null = mkdir "dist/tmp"
}

if ($browser -eq "chrome")
{
cp addon/chrome/* dist/tmp
echo "copy chrome manifest"
} else
{
cp addon/firefox/* dist/tmp
echo "copy firefox manifest"
}

cd src
try
{
Copy-Item "./" -destination "../dist/tmp" -recurse -erroraction stop
Copy-Item "./" -destination "../dist/tmp" -recurse -erroraction SilentlyContinue
echo "created tmp folder"
echo "copy src in tmp folder"
}
catch
} catch
{
echo "error copying src folder"
exit -1
}

try {
(Get-Content "./manifest.json" -erroraction stop) -replace "^}", ',"applications": {"gecko": {"id": "resting@owlcode.eu"}}}' |
Set-Content "../dist/tmp/manifest.json" -erroraction stop
try
{
(Get-Content "../dist/tmp/manifest.json" -erroraction stop) -replace "^}", ',"applications": {"gecko": {"id": "resting@owlcode.eu"}}}' |
Set-Content "../dist/tmp/manifest.json" -erroraction stop
echo "editing manifest.json"
}
catch {
} catch
{
echo "error editing manifest"
exit -1
}
Expand All @@ -48,20 +69,24 @@ echo "move to folder $getPwd"
Compress-Archive -path * -destinationpath "../resting-unsigned.xpi"

cd "../.."
try {
try
{
Compress-Archive -path "./README.md","./LICENSE" -update -destinationpath "./dist/resting-unsigned.xpi" -erroraction stop
echo "creating xpi file"
}
catch {
} catch
{
echo "error creating xpi file"
}

try {
try
{
Remove-Item ".\dist\tmp\" -recurse -erroraction stop
echo "delete tmp folder"
}
catch {
} catch
{
echo "error deleting tmp folder"
}

cd $currPwd
cd $currPwd

echo "Done"
1 change: 1 addition & 0 deletions scripts/build-vue-comp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ $CLI_PATH="node_modules/.bin"
& "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name add-folder-button "$COMPONENTS_FOLDER/AddFolderButton.vue"
& "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name bookmarks-menu "$COMPONENTS_FOLDER/BookmarksMenu.vue"
& "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name response-menu "$COMPONENTS_FOLDER/ResponseMenu.vue"
& "$CLI_PATH/vue-cli-service.ps1" build --target lib --formats umd --dest $DIST_FOLDER --no-clean --name response-viewer "$COMPONENTS_FOLDER/ResponseViewer.vue"

0 comments on commit 5313dc2

Please sign in to comment.