firefox
This commit is contained in:
parent
5d03f8fb38
commit
c5f9dad0f9
18 changed files with 1845 additions and 0 deletions
24
scripts/build-xpi.ps1
Normal file
24
scripts/build-xpi.ps1
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
param(
|
||||
[string]$Source = "firefox",
|
||||
[string]$Output = "firefox-extension.xpi"
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repoRoot = Resolve-Path (Join-Path $scriptRoot "..")
|
||||
$sourcePath = Join-Path $repoRoot $Source
|
||||
$outputPath = Join-Path $repoRoot $Output
|
||||
|
||||
if (-not (Test-Path -Path $sourcePath -PathType Container)) {
|
||||
throw "Source folder '$sourcePath' was not found."
|
||||
}
|
||||
|
||||
if (Test-Path -Path $outputPath -PathType Leaf) {
|
||||
Remove-Item -Path $outputPath -Force
|
||||
}
|
||||
|
||||
Compress-Archive -Path (Join-Path $sourcePath "*") -DestinationPath $outputPath -Force
|
||||
|
||||
Write-Host "Created XPI at $outputPath"
|
||||
29
scripts/build-xpi.sh
Normal file
29
scripts/build-xpi.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SOURCE_DIR="${1:-firefox}"
|
||||
OUTPUT_FILE="${2:-firefox-extension.xpi}"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
SOURCE_PATH="${REPO_ROOT}/${SOURCE_DIR}"
|
||||
OUTPUT_PATH="${REPO_ROOT}/${OUTPUT_FILE}"
|
||||
|
||||
if [[ ! -d "${SOURCE_PATH}" ]]; then
|
||||
echo "Source folder '${SOURCE_PATH}' was not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v zip >/dev/null 2>&1; then
|
||||
echo "The 'zip' command is required but was not found in PATH." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f "${OUTPUT_PATH}"
|
||||
|
||||
(
|
||||
cd "${SOURCE_PATH}"
|
||||
zip -r "${OUTPUT_PATH}" . >/dev/null
|
||||
)
|
||||
|
||||
echo "Created XPI at ${OUTPUT_PATH}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue