Compare commits

...
2 Commits
Author SHA1 Message Date
chrnx de7d695f65 Merge pull request 'fix: list the official plugins from JSR, where they now live' (#1) from fix/jsr-only-entries into develop 2026-09-24 15:29:20 +00:00
chrnx 4b8d56e8e7 fix: list the official plugins from JSR, where they now live
The three @green-tea plugins shipped JSR-only on 2026-09-23, so their
npm: lines pointed at packages that 404 and failed the build on CI. npm
stays a valid registry for anyone else's entry.

preview.mjs goes with them: it stood in for unpublished packages. Off CI
a registry failure now leaves the entry out instead of rendering data
nobody read from a registry.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-09-24 09:52:58 -05:00
6 changed files with 22 additions and 40 deletions

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
// What the seed plugins declare, copied from their `package.json` in Green-Tea/plugins.
//
// This exists so the site can be designed and reviewed before the packages ship. It is used ONLY
// when a registry has no answer and `CI` is unset — in GitHub Actions a missing package fails the
// build instead, which is where the real check lives.
//
// **Delete this file, and its import in `src/pages/index.astro`, once the three are published.**
// Every entry here is a claim nobody verified; the registry is the source of truth and this is a
// stand-in for a registry that does not have the package yet.
export const PREVIEW = {
'@green-tea/jwt': { version: '26.9.0-beta.0', engines: { node: '>=22', deno: '>=2', bun: '>=1.3' } },
'@green-tea/metrics': { version: '26.9.0-beta.0', engines: { node: '>=22', deno: '>=2', bun: '>=1.3' } },
'@green-tea/rate-limit': { version: '26.9.0-beta.0', engines: { node: '>=22', deno: '>=2', bun: '>=1.3' } },
};
+9 -11
View File
@@ -10,8 +10,8 @@ export const RUNTIMES = Object.freeze(['node', 'deno', 'bun', 'workerd']);
* *
* In GitHub Actions a package that does not answer is a failure — that is the check, and it runs * In GitHub Actions a package that does not answer is a failure — that is the check, and it runs
* against the live registries on every pull request and every push to main. Locally it is a * against the live registries on every pull request and every push to main. Locally it is a
* warning and the card renders from `preview.mjs`, because a site you cannot look at until its * warning and the entry is left out, so the site can still be looked at while one package is
* packages ship is a site nobody can design. * broken — without rendering data nobody read from a registry.
*/ */
export const STRICT = process.env.CI === 'true'; export const STRICT = process.env.CI === 'true';
@@ -109,19 +109,19 @@ export function declaredRuntimes({ engines, runtimeCompat }) {
} }
/** /**
* Everything one card needs, live where possible. * Everything one card needs, live.
* *
* Under `CI` a registry that does not answer throws and fails the build, which is the rule that * Under `CI` a registry that does not answer throws and fails the build, which is the rule that
* stops a stale or half-empty listing reaching production. Off CI it falls back to `preview.mjs` * stops a stale or half-empty listing reaching production. Off CI it warns and returns `null`, and
* and says so, loudly, once per package. * the caller leaves the entry out.
*/ */
export async function readEntry(entry, preview) { export async function readEntry(entry) {
try { try {
const npm = entry.npm ? await readNpm(entry.npm) : undefined; const npm = entry.npm ? await readNpm(entry.npm) : undefined;
const jsr = entry.jsr ? await readJsr(entry.jsr) : undefined; const jsr = entry.jsr ? await readJsr(entry.jsr) : undefined;
return { return {
version: (npm ?? jsr).newest, version: (jsr ?? npm).newest,
// npm's `engines` is the richer of the two — JSR's `runtimeCompat` is empty far more often, // npm's `engines` is the richer of the two — JSR's `runtimeCompat` is empty far more often,
// including on `@green-tea/core` itself — so it wins when both exist. // including on `@green-tea/core` itself — so it wins when both exist.
runtimes: declaredRuntimes({ engines: npm?.engines, runtimeCompat: jsr?.runtimeCompat }), runtimes: declaredRuntimes({ engines: npm?.engines, runtimeCompat: jsr?.runtimeCompat }),
@@ -129,10 +129,8 @@ export async function readEntry(entry, preview) {
}; };
} catch (error) { } catch (error) {
if (STRICT) throw error; if (STRICT) throw error;
const fallback = preview[entry.npm ?? entry.jsr]; console.warn(` left out, registry did not answer: ${entry.jsr ?? entry.npm} (${error.message})`);
if (!fallback) throw error;
console.warn(` not published yet, rendering from preview data: ${entry.npm ?? entry.jsr}`);
return { version: fallback.version, runtimes: declaredRuntimes({ engines: fallback.engines }), live: false }; return null;
} }
} }
-1
View File
@@ -1,4 +1,3 @@
npm: "@green-tea/jwt"
jsr: "@green-tea/jwt" jsr: "@green-tea/jwt"
repo: https://github.com/Expressive-Tea/green-tea-plugins repo: https://github.com/Expressive-Tea/green-tea-plugins
description: "Loads JWT signing keys at boot and publishes a sign/verify registry into the graph." description: "Loads JWT signing keys at boot and publishes a sign/verify registry into the graph."
-1
View File
@@ -1,4 +1,3 @@
npm: "@green-tea/metrics"
jsr: "@green-tea/metrics" jsr: "@green-tea/metrics"
repo: https://github.com/Expressive-Tea/green-tea-plugins repo: https://github.com/Expressive-Tea/green-tea-plugins
description: "Counts green-tea's lifecycle events and renders them in the Prometheus text format." description: "Counts green-tea's lifecycle events and renders them in the Prometheus text format."
-1
View File
@@ -1,4 +1,3 @@
npm: "@green-tea/rate-limit"
jsr: "@green-tea/rate-limit" jsr: "@green-tea/rate-limit"
repo: https://github.com/Expressive-Tea/green-tea-plugins repo: https://github.com/Expressive-Tea/green-tea-plugins
description: "A per-request rate limiter with a branded 429 and a swept in-memory store." description: "A per-request rate limiter with a branded 429 and a swept in-memory store."
+13 -12
View File
@@ -1,34 +1,35 @@
--- ---
import { getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
import { readEntry } from '../../scripts/registry.mjs'; import { readEntry } from '../../scripts/registry.mjs';
// Remove this import together with scripts/preview.mjs once the seed plugins are published.
import { PREVIEW } from '../../scripts/preview.mjs';
import Header from '../components/Header.astro'; import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro'; import Footer from '../components/Footer.astro';
import PluginCard from '../components/PluginCard.astro'; import PluginCard from '../components/PluginCard.astro';
import '../styles/global.css'; import '../styles/global.css';
// Read at build time, never at request time — this site is static files on cPanel. Under CI a // Read at build time, never at request time — this site is static files on cPanel. Under CI a
// registry that does not answer fails the build; off CI an unpublished package falls back to // registry that does not answer fails the build; off CI that entry is left out. See
// preview data so the page can still be looked at. See scripts/registry.mjs. // scripts/registry.mjs.
const entries = await getCollection('plugins'); const entries = await getCollection('plugins');
const plugins = await Promise.all( const plugins = (
await Promise.all(
entries.map(async (entry) => { entries.map(async (entry) => {
const { version, runtimes } = await readEntry(entry.data, PREVIEW); const live = await readEntry(entry.data);
if (!live) return null;
return { return {
name: entry.data.npm ?? entry.data.jsr, name: entry.data.jsr ?? entry.data.npm,
description: entry.data.description, description: entry.data.description,
repo: entry.data.repo, repo: entry.data.repo,
npm: entry.data.npm, npm: entry.data.npm,
jsr: entry.data.jsr, jsr: entry.data.jsr,
version, version: live.version,
runtimes, runtimes: live.runtimes,
// An internal plugin could be listed on JSR alone and still be ours, so check both fields. // An internal plugin could be listed on npm alone and still be ours, so check both fields.
internal: (entry.data.npm ?? entry.data.jsr ?? '').startsWith('@green-tea/'), internal: (entry.data.jsr ?? entry.data.npm ?? '').startsWith('@green-tea/'),
}; };
}), }),
); )
).filter((plugin) => plugin !== null);
plugins.sort((a, b) => a.name.localeCompare(b.name)); plugins.sort((a, b) => a.name.localeCompare(b.name));
--- ---