The READMEs still described a dual publish, and none of them carried an install
command at all — so the instruction a reader would infer, `npm i
@green-tea/jwt`, is the one command that no longer works. Each package README is
also the page JSR renders, which makes it the first thing anyone sees.
Adds `npx jsr add` to all three, with the deno and bun forms, and says plainly
that there is no npmjs.org package rather than letting someone find out from a
404.
Also corrects a claim in the root README that this branch made false: "installing
one never pulls a second copy of core". Measured while deciding this change — a
plugin names an exact core in `deno.json`, and across a minor boundary npm nests
a second copy instead of deduplicating. The copy is inert, since a plugin's built
code never imports core, and that is worth saying precisely: what is guaranteed
is which core *runs*, not how many are on disk.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The second registry was costing a tsup config per package, a dual `exports`
map and a `dist/` that could go stale between a merge and a release — and it
was not buying a reader anything. `npx jsr add @green-tea/<name>` installs
under npm, yarn, pnpm and bun through `npm.jsr.io`: one line in `.npmrc`, and
the import specifier stays `@green-tea/<name>`. The `@jsr/` name only ever
appears in the lockfile.
Nothing is published yet — all three packages are absent from both registries
— so this costs no consumer anything, and it is the reversible direction:
adding npm later breaks nobody, while removing it after a publish would.
JSR is also the only one of the two that can record *where a plugin runs*, per
package, which is not cosmetic for a framework whose claim is one app on four
runtimes. `jwt` needs `node:fs/promises` and cannot serve workerd; `metrics`
imports nothing and runs everywhere. npm has nowhere to put that.
`private: true` stays and becomes the guard: an accidental `npm publish` now
fails rather than shipping entry points that describe a build nobody runs.
`test/workspace.test.ts` pins that invariant instead of the dual-registry one.
The CI job keeps the name `build` deliberately — renaming it would change a
required status check on the protected branches, which is a separate change.
`deno publish --dry-run` in the `runtimes` job now stands in for the build, and
it is the publish path these packages actually take.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Every package exported `./src/index.ts` and had no build at all, which made the
npm half of the dual publish unusable. Measured against a staging registry with
`@green-tea/metrics` installed into a clean project: Node threw
ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING, `--experimental-strip-types` threw
the same error because Node refuses to strip types under `node_modules`
unconditionally, and Deno-via-npm threw it too. Only Bun could import it. The
release pipeline would have published that to both registries at once.
JSR needs no help — it transpiles on publish and hands Node an ESM package with
generated declarations — so `deno.json` keeps exporting `src/`. The build exists
for npm alone, as CJS and ESM: core is `"type": "commonjs"` and publishes both,
so a CJS application has to be able to `require()` a plugin.
Core stays external in the declarations. tsup bundles devDependencies by
default, and convention rule 8 puts core there, so without that line every
plugin would have shipped a frozen private copy of a contract core owns.
Verified by packing all three and consuming them from outside the workspace:
`require()` and `import` both resolve under Node, Bun and Deno, and `tsc`
type-checks clean under `node16` and `bundler` resolution.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The transformer is exported instead of a route: the path, the auth and whether
the endpoint exists are the application's decisions, and a plugin that mounted
/metrics itself would be taking them.
No onShutdown — a bus subscription is an entry in a set and keeps nothing alive,
which is what rule 7 asks about. Closes green-tea#68.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
A failed request emits three lifecycle events. request:end is the terminal and
universal one, so it is the request counter; request:failed is additional and
gets its own series. Counting both as requests is the double count issue #64
was filed for.
Labels come from route, which the route table bounds, never from name, which
carries the arriving path and is bounded by nothing — issue #65.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The README carries the cardinality rule up front: label on route, which the
route table bounds, never on name, which nothing bounds. That is the mistake
issue #65 was filed for and the one a collector makes by default.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>