Skip to content

Build and commands

Before you start

  • Install Node.js 20 or later, and npm. For the harness, install ungoogled-chromium. The launch script looks for the program in this sequence: CHROMIUM_PATH, then /Applications/Chromium.app/Contents/MacOS/Chromium, then ungoogled-chromium, chromium, or chromium-browser in PATH.
  • Run npm install. The postinstall step runs wxt prepare and makes .wxt/tsconfig.json again. You must do this in a new copy of the repository before npm run compile.

Commands

CommandFunction
npm run dev / npm run dev:firefoxStart the WXT server for development
npm run build / npm run build:firefoxMake the build in .output/chrome-mv3 or in the Firefox directory
npm run zip / npm run zip:firefoxMake a ZIP file for the store
npm run compileExamine the types (tsc --noEmit)
npm testRun all Vitest tests (see tests). No browser, no requests
npm run test:watchRun Vitest and keep it in operation for each change
npm run normalize:checkExamine the normalizer with the recorded data (tests/normalize.test.ts)
npm run throttle:checkExamine the request limits (see request limits)
npm run docs:checkExamine the frontmatter, links, and paths of this site and memory.md
npm run browser:launchStart the harness browser. Other flags go to the browser
npm run api:inspect [-- --once | --check]Record the answers of Patreon in .api-dumps/
npm run api:checkExamine the session and the memberships. Exit code 0 means that the session is correct
npm run bundle:mine [-- --visit=<url>]Read the JavaScript files of the web site for the list of endpoints
npm run site:devStart this documentation site locally
npm run site:buildBuild this documentation site

Files in the repository

entrypoints/ WXT entrypoints
background.ts Service worker: routes messages, limits requests, writes the cache
patreon.content.ts Runner: fetch, classify, normalize
sidepanel/ Side panel on Chrome, sidebar on Firefox
tab/ Extension tab; operates on all browsers
lib/ Code that all surfaces use
db.ts Dexie schema and transactions
messages.ts Message contract, examination, failure codes
throttle.ts Request limits and backoff
media-cache.ts Cache API for media bytes
format.ts Formats numbers, sizes, and dates
gallery.ts Joins the images onto the posts for the photo view
patreon/ jsonapi.ts, endpoints.ts, normalize.ts, types.ts
components/ The panel
App.tsx Layout, queries, actions, keyboard
MembershipList.tsx Filters.tsx PostList.tsx PostCard.tsx
PhotoGallery.tsx The photo view: square tiles, one section for each month
media.tsx One viewer for each media type, and the image viewer
RichText.tsx Makes React elements from permitted HTML
StatusBanner.tsx Text for each failure and each empty condition
LanguagePicker.tsx The language setting, in the header
i18n.tsx hooks.ts The translator; messages and storage
globals.css Palette, Tailwind theme, container width
ui/ The components from the Aqua registry (`@aqua`)
tests/ Vitest tests
normalize.test.ts Examine the normalizer with the recorded answers
throttle.test.ts Examine the request limits
docs.test.ts Examine this site and `memory.md`
i18n.test.ts Examine the localization layer
gallery.test.ts Examine the join behind the photo view
scripts/ Tools that tsx runs
launch-browser.sh Start Chromium with CDP on port 9222
inspect-api.ts Record the answers of Patreon
mine-bundle.ts Read the JavaScript files for the list of endpoints
site/ This documentation site (Astro + Starlight)
public/ Icons and gopher.svg