chrome+firefox v0.3.1 Makefile and dist/ build/ folders

This commit is contained in:
2026-08-10 16:14:56 -03:00
parent a7531914f9
commit 5176301116
9 changed files with 100 additions and 49 deletions

View File

@@ -19,7 +19,7 @@ Once it is published, from addons.mozilla.org. Until then, build it yourself:
```
corepack pnpm install # first time, or after a dependency change
make xpi # typecheck, bundle, and package dist/logsdu-<version>.xpi
make xpi # bundle and package dist/logsdu-<version>-firefox.xpi
```
`make xpi` prints the full path of the file and how to install it. The package
@@ -119,12 +119,12 @@ check.
## Chrome
```
make chrome # unpacked Chrome build in build/
make chrome # unpacked Chrome build in build/chrome/
make crx # package it as dist/logsdu-<version>-chrome.zip
```
Load `build/` via `chrome://extensions` -> Developer mode -> **Load unpacked**,
or upload the zip at
Load `build/chrome/` via `chrome://extensions` -> Developer mode -> **Load
unpacked** (select the folder itself), or upload the zip at
[the Web Store dashboard](https://chrome.google.com/webstore/devconsole).
One codebase, two manifests. Chrome MV3 requires a background *service worker*
@@ -156,21 +156,29 @@ script instead.
```
corepack pnpm install
make # everything: build and package both browsers
make firefox # build Firefox only -> build/firefox/
make chrome # build Chrome only -> build/chrome/
make test # unit tests
make smoke # background bundle under a service worker
make # typecheck and bundle into build/
make packages # both publishable packages into dist/
corepack pnpm run dev # rebuild on change
make clean
corepack pnpm run dev # rebuild Firefox on change
make clean # remove build/, dist/ and stray packages
make distclean # clean, plus node_modules/
```
`build/` is the unpacked extension and is regenerated from scratch every time.
`dist/` holds the packages meant to be published, and is kept separate so that
packaging never tries to include its own output.
A bare `make` typechecks once, bundles for both browsers into `build/`, and
packages both into `dist/`. Packaging is only a zip of a directory that was
going to be built anyway, so it costs nothing and keeps `dist/` from drifting
out of step with the sources.
Each browser gets its own directory under `build/`, so the two can coexist and
neither is ever left stale by the other. `dist/` holds the packages meant to be
published, and is kept out of `build/` so that packaging never tries to include
its own output.
While iterating, load the unpacked directory rather than reinstalling an `.xpi`
each time: `about:debugging` -> **This Firefox** -> **Load Temporary Add-on** ->
`build/manifest.json`, then press **Reload** there after each rebuild. That copy
`build/firefox/manifest.json`, then press **Reload** there after each rebuild. That copy
disappears on restart, which is the point -- it is for development, not daily
use.