1f3a42e7475bd4086b84c5e512d0d97042b7d4c6
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
32baf0c592 |
ci: publish to JSR from a dated tag, and close the changelogs
Adds the release workflow and the script it leans on, plus the `[Unreleased]` sections these three packages have carried since they were written. **The tag is a date, not a version.** `release-26.9.23` says when; the release body says what moved. A version-shaped tag would be a lie here — three packages carry three independent versions, so `plugins-v26.9.0` would match none of them and invite being read as `@green-tea/jwt@26.9.0`. **Tag-driven, not push-driven.** JSR's own setup page offers an example that publishes on every push to `main`. For this repository that means every promotion publishes, and a JSR version can never be replaced or removed, so one distracted merge would burn a version number permanently. A tag is a decision; a merge is not. **Publishing all three at once is safe, and that is measured rather than assumed.** `deno publish` queries the registry per package and drops the ones already there (`filter_out_published_packages` in denoland/deno, cli/tools/publish/mod.rs); skipping logs a warning, and a workspace with nothing left to do exits 0 with "All packages are already published". So a tag cut after changing one package publishes that one and leaves the others alone, with no per-package logic here. `scripts/release.mjs --check` runs **before** the publish and refuses when a version about to ship has no changelog entry. That ordering is the point: core's equivalent runs after npm and JSR have already published, so a missing heading fails a release that has already shipped. Worth not inheriting. `--notes` builds the release body from what `deno publish` actually reported rather than from a prediction of it — predicting means duplicating Deno's filtering and being wrong about it silently. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com> |
||
|
|
686a4527cf |
docs(plugins): give each package a header, and stop leaning on a marketplace
Each README now opens the way core's does — logo, name, one line saying what the package is for. The package README is the page JSR renders, so it is the first thing anyone sees, and three of them opened with a bare `# @green-tea/x`. The logo is an absolute URL rather than a relative path, deliberately. Core's README points at `./assets/logo.png`, and core's `publish.include` does not ship `assets/` — so that image 404s on core's JSR page today. Repeating the pattern three more times would have repeated the bug three more times. Also drops the claim that npmjs.org discovery does not matter "where the marketplace is the channel anyway". There is no marketplace yet, and a plugin should stand on its own rather than on a site that has not shipped. The cost is now stated plainly instead of argued away. Corrects "their built code never imports it": with JSR publishing the source, the build is JSR's, not ours. What holds is that a type import leaves nothing behind, so the published JavaScript never mentions core. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com> |
||
|
|
16f8329794 |
docs(plugins): say how to install now that npm is not an option
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> |
||
|
|
4caf8809df |
chore(plugins): publish to JSR alone, and drop the npm build
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> |
||
|
|
772f4d11a9 |
docs: list every package, and show the graph doing the work
The root README still advertised one package, three releases in. jwt and rate-limit both demonstrated themselves from inside a handler, which reads as a middleware chain with extra steps. Signing does belong there — it is the response to that one request — but verifying is a precondition shared by every protected route, and its result is what those routes are actually asking for. Shown as a `@Step` that provides `user`, so the handler asks for `user` and never for `jwt`. rate-limit gains the same treatment plus the constraint that makes it work: the step must provide a token the handler names. `subgraphFor` builds each route's closure backwards from the handler's `needs`, so a step providing something nobody asks for is not in the closure and never runs — the limit would silently not apply, which is the worst way for a rate limiter to fail. The inline call is kept as the smaller option, with what it costs. metrics is left alone: rendering a scrape really is a route's job. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com> |
||
|
|
3b1eceecb9 |
build: publish a real build to npm, and the source to JSR
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> |
||
|
|
1c0b6bde91 |
feat(jwt): load signing keys at boot as a named plugin
Extracted from patitas-peludas onto the object plugin contract. Core is a type import only, so installing the plugin never drags in a second core or a version warning; a bad key still fails boot, which the contract tests now pin. The extraction moves from jose 5 to jose 6, and that is not a version bump: jose 6 refuses a private CryptoKey in jwtVerify, where jose 5 accepted one and derived the public half itself. The original keeps a single key per signer and verifies with the key it signed with, which works on 5 and throws "CryptoKey instances must be of type public" on 6 — for every asymmetric algorithm, so ES*, RS*, PS* and EdDSA alike. Symmetric keys are unaffected, which is exactly why one HS256 test would have shipped it. importJWKKey now imports the key twice for an asymmetric pair: as given, to sign with, and with the private fields stripped, to verify with. A symmetric key has no public half, so it keeps one secret for both. The round-trip is covered per algorithm family rather than once, because one algorithm is not coverage — it is the gap the defect lived in. The get() helper in the contract tests is generic in its body: Response.json() is typed Promise<unknown>, so reaching into the payload did not typecheck. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com> |
||
|
|
42a2f490e8 |
test: check each package against the plugin convention
Rules 8 and 9 are the two a reviewer cannot see from a diff: where core sits in package.json, and whether engines, the README table and JSR still agree. A static test makes a drift fail the build instead of reaching a user. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com> |