Files
tab-park/tools/build.sh
T
2026-11-11 20:24:24 +01:00

43 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Builds the loadable copy of the extension:
# dist/tabpark unpacked, for about:debugging
# dist/tabpark.xpi zipped, for handing over or uploading to AMO
set -euo pipefail
SRC="$(cd "$(dirname "$0")/.." && pwd)"
OUT="$SRC/dist"
DEST="$OUT/tabpark"
rm -rf "$OUT"
mkdir -p "$DEST"
cp "$SRC"/manifest.json "$SRC"/common.js "$SRC"/background.js \
"$SRC"/popup.html "$SRC"/popup.js "$SRC"/popup.css \
"$SRC"/options.html "$SRC"/options.js "$SRC"/options.css "$DEST"/
cp -r "$SRC"/icons "$DEST"/
python3 - "$OUT" <<'PY'
import os, sys, zipfile
out = sys.argv[1]
src = os.path.join(out, 'tabpark')
xpi = os.path.join(out, 'tabpark.xpi')
with zipfile.ZipFile(xpi, 'w', zipfile.ZIP_DEFLATED) as archive:
for root, _, files in os.walk(src):
for filename in files:
full = os.path.join(root, filename)
archive.write(full, os.path.relpath(full, src))
PY
cat > "$OUT/README.md" <<'MD'
# Tab Park build
`tabpark/` is the unpacked extension. Load it with
about:debugging#/runtime/this-firefox > Load Temporary Add-on > pick
`tabpark/manifest.json`.
`tabpark.xpi` is the same files zipped, for handing to someone else or
uploading to addons.mozilla.org.
MD
echo "built $DEST and $OUT/tabpark.xpi"