31ee70ec4da4
add .amoignore exclusion list and scripts/package-amo-source.sh
- time
- 2026-05-20 17:04 UTC · 5 months ago
- machine
- koh2
- parent
- 049f4916c04f
↓ peach-browser-31ee70ec.tar.gzatlas at this save
files changed2 files
.amoignore+73 −0scripts/package-amo-source.sh+100 −0.amoignore+73 −0
@@ -0,0 +1,73 @@1+# Exclusion list for the AMO source archive packager.2+# Format: one pattern per line, relative to the repo root.3+# Lines starting with '#' and blank lines are ignored.4+5+# Dependency install dirs — reviewers reinstall from package-lock.json6+node_modules7+node_modules/8+9+# Build output — reviewers run the build themselves10+dist11+dist/12+dist-chrome13+dist-chrome/14+dist-firefox15+dist-firefox/16+dist-mobile17+dist-mobile/18+19+# Koh internal version control state20+.koh21+.koh/22+23+# Git internals (history is not part of the AMO submission)24+.git25+.git/26+27+# macOS / OS detritus28+.DS_Store29+__MACOSX30+31+# Editor / IDE state32+.vscode33+.vscode/34+.idea35+.idea/36+.cursor37+.cursor/38+39+# Local agent / scratch state40+.agent41+.agent/42+.gstack43+.gstack/44+.playwright-mcp45+.playwright-mcp/46+.sisyphus47+.sisyphus/48+memory49+memory/50+.claude51+.claude/52+53+# Test artifacts54+test-results55+test-results/56+.playwright-mcp57+tsconfig.tsbuildinfo58+59+# Credential / env files60+.env61+.env.*62+63+# Stray packaged extension archives at the repo root64+peach-*.zip65+peach-*.crx66+peach-*.xpi67+68+# Source archives produced by this very script (don't recurse into ourselves)69+peach-3.6.65-source.zip70+71+# Lockfiles for package managers we don't use for releases72+pnpm-lock.yaml73+bun.lockscripts/package-amo-source.sh+100 −0
@@ -0,0 +1,100 @@1+#!/usr/bin/env bash2+#3+# package-amo-source.sh — produce peach-3.6.65-source.zip for AMO review.4+#5+# Reviewers must be able to reproduce the submitted peach-3.6.65.zip from6+# the contents of this archive. The archive is staged into a temporary7+# directory using rsync with .amoignore as the exclusion list, then zipped8+# with sorted entry order so the archive is reproducible across runs.9+#10+# This script does not use `rm`. All deletions go through `trash` per the11+# project convention; the only filesystem removal happens through `trash`12+# acting on the staging directory.13+14+set -euo pipefail15+16+VERSION="3.6.65"17+ARCHIVE_NAME="peach-${VERSION}-source.zip"18+19+REPO_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"20+cd "$REPO_ROOT"21+22+# ---- 1. Sanity checks ------------------------------------------------------23+24+# Working tree should be clean per koh — if it isn't, surface state and stop.25+if command -v koh >/dev/null 2>&1; then26+ KOH_STATUS_JSON="$(koh status --json 2>/dev/null || true)"27+ if printf '%s' "$KOH_STATUS_JSON" | grep -q '"dirty":true'; then28+ echo "error: working tree is dirty per koh status. Save or stash before packaging." >&229+ echo "$KOH_STATUS_JSON" >&230+ exit 131+ fi32+fi33+34+# Confirm manifest version matches what we're packaging.35+MANIFEST_VERSION="$(node -e 'console.log(JSON.parse(require("fs").readFileSync("manifest.firefox.json","utf8")).version)')"36+if [ "$MANIFEST_VERSION" != "$VERSION" ]; then37+ echo "error: manifest.firefox.json version is $MANIFEST_VERSION, expected $VERSION" >&238+ exit 139+fi40+41+# Confirm .amoignore exists.42+if [ ! -f .amoignore ]; then43+ echo "error: .amoignore not found at repo root" >&244+ exit 145+fi46+47+# ---- 2. Stage into a temp directory ---------------------------------------48+49+STAGE_DIR="$(mktemp -d -t peach-amo-source.XXXXXX)"50+STAGE_SUBDIR="$STAGE_DIR/peach-${VERSION}-source"51+mkdir -p "$STAGE_SUBDIR"52+53+# Use rsync with --exclude-from to apply .amoignore. rsync interprets the54+# patterns the same way for the source side, so the result is deterministic55+# given the same input tree.56+rsync -a \57+ --exclude-from=.amoignore \58+ --exclude='.amoignore' \59+ ./ "$STAGE_SUBDIR/"60+61+# Drop README.amo.md and .amoignore explicitly at the archive root.62+cp README.amo.md "$STAGE_SUBDIR/README.amo.md"63+cp .amoignore "$STAGE_SUBDIR/.amoignore"64+65+# ---- 3. Produce a reproducible zip ----------------------------------------66+67+OUT_PATH="$REPO_ROOT/$ARCHIVE_NAME"68+69+# Remove any prior archive at the destination, via `trash` (never `rm`).70+if [ -e "$OUT_PATH" ]; then71+ trash "$OUT_PATH"72+fi73+74+# Build a sorted file list and feed it to zip via -@ so entry order is75+# stable across runs and across filesystems with different traversal orders.76+(77+ cd "$STAGE_SUBDIR"78+ # Use find with -print0 / sort -z for safety, then translate back to79+ # newline-terminated for `zip -@`. No filenames in this repo contain80+ # newlines, but the NUL pipeline keeps the script robust.81+ find . -type f -print0 \82+ | LC_ALL=C sort -z \83+ | tr '\0' '\n' \84+ | zip -X -q -@ "$OUT_PATH"85+)86+87+# ---- 4. Report -------------------------------------------------------------88+89+SIZE_BYTES="$(stat -f%z "$OUT_PATH" 2>/dev/null || stat -c%s "$OUT_PATH")"90+SHA256="$(shasum -a 256 "$OUT_PATH" | awk '{print $1}')"91+92+echo ""93+echo "AMO source archive: $OUT_PATH"94+echo " size: $SIZE_BYTES bytes"95+echo " sha256: $SHA256"96+echo ""97+98+# ---- 5. Clean up staging via `trash` --------------------------------------99+100+trash "$STAGE_DIR"