#!/usr/bin/env bash # Copyright 2026 Oliver Herb # SPDX-License-Identifier: MPL-2.0 # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. # Builds the add-on package: an XPI file (a ZIP archive of src/ plus LICENSE). # # Output: dist/inline-comment-.xpi, where is read from # src/manifest.json. An existing file of the same name is replaced, and the # path of the new file is printed on success. # # Usage: npm run build (runs the format check and the tests first) # bash scripts/build.sh (packages only, without checks) # # Requires: bash, node and zip. set -euo pipefail cd "$(dirname "$0")/.." VERSION="$(node -p "require('./src/manifest.json').version")" OUT="dist/inline-comment-${VERSION}.xpi" mkdir -p dist rm -f "$OUT" # Pack the contents of src/ so that manifest.json sits in the XPI root. (cd src && zip -r -X -q "../$OUT" . -x '*.DS_Store' -x '*~') # Ship the licence text in the XPI root next to manifest.json. zip -X -q -j "$OUT" LICENSE echo "$OUT"