From 4b8d56e8e775cf499a7489f9be701c60521528dd Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Thu, 24 Sep 2026 09:52:58 -0500 Subject: [PATCH] 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 --- scripts/preview.mjs | 14 ---------- scripts/registry.mjs | 20 +++++++------- src/content/plugins/jwt.yaml | 1 - src/content/plugins/metrics.yaml | 1 - src/content/plugins/rate-limit.yaml | 1 - src/pages/index.astro | 41 +++++++++++++++-------------- 6 files changed, 30 insertions(+), 48 deletions(-) delete mode 100644 scripts/preview.mjs diff --git a/scripts/preview.mjs b/scripts/preview.mjs deleted file mode 100644 index df78b9b..0000000 --- a/scripts/preview.mjs +++ /dev/null @@ -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' } }, -}; diff --git a/scripts/registry.mjs b/scripts/registry.mjs index f749535..0c4e6ce 100644 --- a/scripts/registry.mjs +++ b/scripts/registry.mjs @@ -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 * 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 - * packages ship is a site nobody can design. + * warning and the entry is left out, so the site can still be looked at while one package is + * broken — without rendering data nobody read from a registry. */ 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 - * stops a stale or half-empty listing reaching production. Off CI it falls back to `preview.mjs` - * and says so, loudly, once per package. + * stops a stale or half-empty listing reaching production. Off CI it warns and returns `null`, and + * the caller leaves the entry out. */ -export async function readEntry(entry, preview) { +export async function readEntry(entry) { try { const npm = entry.npm ? await readNpm(entry.npm) : undefined; const jsr = entry.jsr ? await readJsr(entry.jsr) : undefined; 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, // including on `@green-tea/core` itself — so it wins when both exist. runtimes: declaredRuntimes({ engines: npm?.engines, runtimeCompat: jsr?.runtimeCompat }), @@ -129,10 +129,8 @@ export async function readEntry(entry, preview) { }; } catch (error) { if (STRICT) throw error; - const fallback = preview[entry.npm ?? entry.jsr]; - if (!fallback) throw error; - console.warn(` not published yet, rendering from preview data: ${entry.npm ?? entry.jsr}`); + console.warn(` left out, registry did not answer: ${entry.jsr ?? entry.npm} (${error.message})`); - return { version: fallback.version, runtimes: declaredRuntimes({ engines: fallback.engines }), live: false }; + return null; } } diff --git a/src/content/plugins/jwt.yaml b/src/content/plugins/jwt.yaml index 5fdafde..0d3c8e4 100644 --- a/src/content/plugins/jwt.yaml +++ b/src/content/plugins/jwt.yaml @@ -1,4 +1,3 @@ -npm: "@green-tea/jwt" jsr: "@green-tea/jwt" 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." diff --git a/src/content/plugins/metrics.yaml b/src/content/plugins/metrics.yaml index c31517c..846b3ad 100644 --- a/src/content/plugins/metrics.yaml +++ b/src/content/plugins/metrics.yaml @@ -1,4 +1,3 @@ -npm: "@green-tea/metrics" jsr: "@green-tea/metrics" repo: https://github.com/Expressive-Tea/green-tea-plugins description: "Counts green-tea's lifecycle events and renders them in the Prometheus text format." diff --git a/src/content/plugins/rate-limit.yaml b/src/content/plugins/rate-limit.yaml index f5e0aea..6b640ce 100644 --- a/src/content/plugins/rate-limit.yaml +++ b/src/content/plugins/rate-limit.yaml @@ -1,4 +1,3 @@ -npm: "@green-tea/rate-limit" jsr: "@green-tea/rate-limit" 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." diff --git a/src/pages/index.astro b/src/pages/index.astro index a5ef39c..c91d886 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,34 +1,35 @@ --- import { getCollection } from 'astro:content'; 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 Footer from '../components/Footer.astro'; import PluginCard from '../components/PluginCard.astro'; import '../styles/global.css'; // 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 -// preview data so the page can still be looked at. See scripts/registry.mjs. +// registry that does not answer fails the build; off CI that entry is left out. See +// scripts/registry.mjs. const entries = await getCollection('plugins'); -const plugins = await Promise.all( - entries.map(async (entry) => { - const { version, runtimes } = await readEntry(entry.data, PREVIEW); +const plugins = ( + await Promise.all( + entries.map(async (entry) => { + const live = await readEntry(entry.data); + if (!live) return null; - return { - name: entry.data.npm ?? entry.data.jsr, - description: entry.data.description, - repo: entry.data.repo, - npm: entry.data.npm, - jsr: entry.data.jsr, - version, - runtimes, - // An internal plugin could be listed on JSR alone and still be ours, so check both fields. - internal: (entry.data.npm ?? entry.data.jsr ?? '').startsWith('@green-tea/'), - }; - }), -); + return { + name: entry.data.jsr ?? entry.data.npm, + description: entry.data.description, + repo: entry.data.repo, + npm: entry.data.npm, + jsr: entry.data.jsr, + version: live.version, + runtimes: live.runtimes, + // An internal plugin could be listed on npm alone and still be ours, so check both fields. + internal: (entry.data.jsr ?? entry.data.npm ?? '').startsWith('@green-tea/'), + }; + }), + ) +).filter((plugin) => plugin !== null); plugins.sort((a, b) => a.name.localeCompare(b.name)); --- -- 2.54.1