diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3215d88..7d7a1d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,5 +30,9 @@ jobs: path: test-results/ - uses: actions/upload-artifact@v7 with: - name: spectral-extension + name: spectral-chromium path: dist/ + - uses: actions/upload-artifact@v7 + with: + name: spectral-firefox + path: dist-firefox/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 28e668d..2e2a2d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Release -# Pushing a tag such as v0.1.0 builds the store package and attaches it to a -# GitHub Release, so every uploaded version stays downloadable. +# Pushing a tag such as v0.1.1 builds the store packages (Chromium and Firefox) and +# attaches them to a GitHub Release, so every uploaded version stays downloadable. on: push: tags: ["v*"] @@ -21,7 +21,7 @@ jobs: - name: Check the tag matches the manifest version run: | - manifest=$(jq -r .version public/manifest.json) + manifest=$(jq -r .version src/manifest.json) pkg=$(jq -r .version package.json) echo "Tag: $GITHUB_REF_NAME, manifest: $manifest, package.json: $pkg" test "$GITHUB_REF_NAME" = "v$manifest" @@ -33,14 +33,17 @@ jobs: - run: npm run build - run: npm run firefox:lint - - name: Zip the contents of dist/ + - name: Zip the contents of each build run: | - (cd dist && zip -qrX "../spectral-$VERSION.zip" .) - unzip -l "spectral-$VERSION.zip" + (cd dist && zip -qrX "../spectral-$VERSION-chromium.zip" .) + (cd dist-firefox && zip -qrX "../spectral-$VERSION-firefox.zip" .) + unzip -l "spectral-$VERSION-chromium.zip" + unzip -l "spectral-$VERSION-firefox.zip" - name: Create the release env: GH_TOKEN: ${{ github.token }} run: | - gh release create "$GITHUB_REF_NAME" "spectral-$VERSION.zip" \ + gh release create "$GITHUB_REF_NAME" \ + "spectral-$VERSION-chromium.zip" "spectral-$VERSION-firefox.zip" \ --title "Spectral $VERSION" --generate-notes --verify-tag diff --git a/.gitignore b/.gitignore index afb6dac..81bf611 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ tmp/ ### Project build output node_modules/ dist/ +dist-firefox/ build/ test-results/ playwright-report/ diff --git a/AGENTS.md b/AGENTS.md index fb596bf..cd49fab 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,17 +13,21 @@ by [docs/AI-AGENTS.md](docs/AI-AGENTS.md); `CLAUDE.md` is a pointer to it. - Install: `npm ci` (Node 22 or later). - Validate: `npm run check` (typecheck and unit tests; always run after editing). -- Build: `npm run build` writes the unpacked extension to `dist/` through - `scripts/build.ts`: the popup with `vite.config.ts`, then the background as - a single IIFE with no imports, because Safari does not load module - background scripts. +- Build: `npm run build` writes the unpacked extension to `dist/` (Chromium + browsers and Safari) and `dist-firefox/` through `scripts/build.ts`: the + popup with `vite.config.ts`, then the background as a single IIFE with no + imports, because Safari does not load module background scripts. +- Manifest: edit `src/manifest.json`, never a built one. `scripts/manifest.ts` + adds `background.service_worker` for Chromium (whose stores reject + `background.scripts`) or `background.scripts` for Firefox, and keeps + `browser_specific_settings` only for Firefox. - End-to-end: `npm run test:e2e` drives the built extension in Chromium with a fixture site and mocked DoH and RDAP; run it after `npm run build`. Set `CHROMIUM_PATH` to use an existing Chromium instead of Playwright's. - Icons: `npm run icons` regenerates `public/icons/` from `scripts/icon.svg`; commit both. -- Watch: `npm run dev` rebuilds `dist/` on change; reload the extension in the browser. -- Firefox: `npm run firefox:lint` validates `dist/` for AMO (after a build); +- Watch: `npm run dev` rebuilds `dist/` and `dist-firefox/` on change; reload the extension in the browser. +- Firefox: `npm run firefox:lint` validates `dist-firefox/` for AMO (after a build); `npm run firefox:run` and `npm run firefox:android -- --android-device=` launch it. - Safari on iOS: `.github/workflows/safari.yml` runs on a macOS runner, only on diff --git a/CHANGELOG.md b/CHANGELOG.md index 014478d..2f830fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,11 @@ How to use this file: - Extension icons. - Released under the MIT License. +### Fixed + +- Separate packages for Chromium browsers and Firefox, each declaring only + its own background key, so the Edge Add-ons store accepts the package. +