make dist -> make xpi , better installation process

This commit is contained in:
2026-08-10 14:37:25 -03:00
parent 4d85187fb5
commit 8bf20af4bb
2 changed files with 53 additions and 35 deletions

View File

@@ -24,20 +24,28 @@
# Usage:
# make # typecheck and bundle into build/
# make test # run the unit tests
# make dist # build, then zip build/ into logsdu-<version>.zip
# make clean # remove build/ and the zip
# make xpi # build, then package build/ as logsdu-<version>.xpi
# make clean # remove build/ and the package
#
# Dependencies are installed with pnpm, never npm:
# corepack pnpm install
#
# Load build/ in Firefox: about:debugging -> This Firefox ->
# Load Temporary Add-on -> pick build/manifest.json
# Permanent install (Firefox ESR, Developer Edition or Nightly):
# set xpinstall.signatures.required=false in about:config, then
# about:addons -> gear -> Install Add-on From File -> pick the .xpi
#
# Release Firefox refuses unsigned add-ons whatever that pref says. There the
# same .xpi has to go through addons.mozilla.org as an unlisted add-on first,
# which signs it automatically without publishing or reviewing it.
#
# Throwaway install for development: about:debugging -> This Firefox ->
# Load Temporary Add-on -> pick build/manifest.json (dropped on restart).
EXT_ID := logsdu
VERSION := $(shell node -p "require('./package.json').version")
DIST := $(EXT_ID)-$(VERSION).zip
XPI := $(EXT_ID)-$(VERSION).xpi
.PHONY: all build test dist clean check-deps
.PHONY: all build test xpi clean check-deps
all: build
@@ -53,16 +61,19 @@ build: check-deps
node_modules/.bin/tsc -noEmit -skipLibCheck
node esbuild.config.mjs production
# A plain zip of build/ is exactly what AMO wants for signing.
dist: build
rm -f $(DIST)
cd build && zip -qr ../$(DIST) .
@echo "Package: $(DIST)"
@echo "Upload it to addons.mozilla.org as an unlisted add-on to get a signed .xpi."
# An .xpi is just a zip of the extension directory, with the manifest at the
# top level rather than inside a wrapper folder. The same file installs
# directly on ESR and uploads to AMO for signing.
xpi: build
rm -f $(XPI)
cd build && zip -qr ../$(XPI) .
@echo "Package: $(XPI)"
@echo "Install: about:addons -> gear -> Install Add-on From File"
@echo "Needs xpinstall.signatures.required=false on ESR/Developer/Nightly."
clean:
rm -rf build
rm -f $(EXT_ID)-*.zip
rm -f $(EXT_ID)-*.xpi $(EXT_ID)-*.zip
# Fail with a useful message rather than a confusing "tsc: not found".
check-deps: