# Guide: Develop and test the add-on This guide covers everything from a fresh clone to a release: build, load the add-on into Thunderbird, debug it and check the package the way addons.thunderbird.net (ATN) does. ## Prerequisites - **Node.js 22 or later** with npm (see `engines` in `package.json`). - **zip** (Info-ZIP) and **bash**, used by `scripts/build.sh` to pack the `.xpi`. On Windows, use Git Bash or WSL and make sure `zip` is on the `PATH`. - **Thunderbird 128 or later** (or Betterbird) for loading and testing the add-on. - Any editor. Formatting is done by Prettier (`npm run format`), so no editor settings are needed. ## Get the code ```bash git clone https://git.hassio-muc.de/Oliver_Herb/inline-comment.git cd inline-comment npm install ``` `npm install` only installs development tools (Prettier, ESLint, jsdom). The add-on itself has no runtime dependencies. ## Everyday commands ```bash npm test # unit and DOM tests (node:test + jsdom), no Thunderbird needed npm run lint # ESLint: JavaScript checks and JSDoc rules npm run format # format all files with Prettier npm run check # format check + lint + tests, run before every push npm run build # check + dist/inline-comment-.xpi ``` Run a single test file with `node --test test/marker.test.js`. The lint configuration is in `eslint.config.mjs`: the recommended rule sets of ESLint and `eslint-plugin-jsdoc`, reported as errors, plus a JSDoc block with typed `@param` and `@returns` tags for every named function. Inline callbacks are exempt. Each part of the code gets the globals of the environment it runs in (Thunderbird extension scripts, the shared `src/lib/` scripts or Node). The `.xpi` is a plain ZIP of `src/` plus the `LICENSE` file. There is no bundler, no transpiler and no minification: every file from `src/` goes into the package unchanged. ## Repository layout | Path | Content | | ------------------- | -------------------------------------------------------------------------- | | `src/manifest.json` | Manifest V3, permissions, version | | `src/background.js` | Registers the compose script, toolbar button, configuration per window | | `src/compose/` | Compose script: catches typing inside a quote and inserts the comment | | `src/lib/` | Testable logic (settings, marker, quote handling, i18n) as classic scripts | | `src/options/` | Options page | | `src/_locales/` | English and German UI texts | | `test/` | Automated tests | | `scripts/build.sh` | Packs the `.xpi` | | `listing/` | Texts for the addons.thunderbird.net listing | | `.docs/`, `.plan/` | Architecture, decisions, guides, roadmap | Background: [architecture overview](../architecture/overview.md). ## Load the add-on in Thunderbird **Temporarily** (until Thunderbird is restarted): 1. Open `about:debugging` (menu `Tools > Developer Tools > Debug Add-ons`, or the gear menu in the Add-ons Manager) and select **This Thunderbird**. 2. Click **Load Temporary Add-on…** and select `dist/inline-comment-.xpi`. Alternatively select `src/manifest.json` to load the sources directly without building. 3. After a new build or a change in `src/`, click **Reload** next to the add-on. 4. Open a new compose window, for example a reply to a message that contains a quote. **Permanently:** open the Add-ons Manager (`Tools > Add-ons and Themes`), click the gear icon, choose **Install Add-on From File…** and select the `.xpi`. Thunderbird and Betterbird do not enforce add-on signatures, so the unsigned build installs this way. A version installed from ATN with the same add-on ID (`inline-comment@ih-engineering.de`) is replaced. ## Debugging - **Background script:** in `about:debugging > This Thunderbird`, click **Inspect** next to Inline Comment. The toolbox shows the console of the background script, the debugger and, under Storage, the extension storage (key `settings` in `storage.local`). - **Compose script:** it runs inside the editor of each compose window. Its messages appear in the Error Console: `Tools > Developer Tools > Error Console` or **Ctrl+Shift+J**. - **Debug output:** enable **Diagnostic output in the error console** in the options (section Advanced) for detailed messages from the compose script. They are written with `console.debug`; if they do not show up, check that the console filter includes debug messages. - All messages of the add-on start with `[Inline Comment]`, so the console can be filtered by that text. ## Manual test The automated tests run in jsdom without a real mail editor. Before a release, work through the manual test plan in Thunderbird: [testplan.md](./testplan.md). ## Release a new version 1. Make the change with tests and run `npm run check`. 2. Raise the version in `package.json` **and** `src/manifest.json` (Semantic Versioning) and add a section for it to `CHANGELOG.md`. `test/manifest.test.js` checks that all three match. 3. Update the documentation (`README.md`, `README.de.md`, `.docs/` and, if the behaviour or the permissions changed, `listing/`) in the same commit. 4. Run `npm run build` and work through the [manual test plan](./testplan.md) with the new `.xpi`. 5. Validate the package as described in the next section. 6. Commit, tag and push: ```bash git commit -am "Release 0.3.0" git tag -a v0.3.0 -m "Inline Comment 0.3.0" git push origin main v0.3.0 ``` 7. Upload the `.xpi` to ATN as a new version. Use the `CHANGELOG.md` section as release notes. The listing texts are in [listing/](../../listing/README.md). ## Validate the package for ATN ATN checks every upload with Mozilla's `addons-linter`, as of November 2026 version 6.15.x (ATN's server pins `~6.15.0`). Run the same version locally against the built package: ```bash npx addons-linter@6.15.0 dist/inline-comment-.xpi ``` - ATN accepts the upload when the linter reports **0 errors**. Warnings are shown to the reviewer but do not block the upload. - **Expected warnings:** `MANIFEST_PERMISSIONS` for `compose` and `accountsRead`. These are Thunderbird permissions that the Firefox-oriented linter does not know, so the warnings are false positives. - Any other warning should be fixed or explained in the notes to reviewers ([listing/notes-to-reviewers.md](../../listing/notes-to-reviewers.md)). **Optional:** Thunderbird's own [webext-linter](https://github.com/thunderbird/webext-linter) knows the Thunderbird APIs and permissions and checks against the ATN review policies: ```bash git clone https://github.com/thunderbird/webext-linter.git cd webext-linter npm install node verify.js /dist/inline-comment-.xpi ```