feat: the plugin listing, built from registry data

One YAML file per plugin. There is deliberately no version and no runtimes
field in an entry: both are read from npm and JSR when the page is built, so a
card cannot go stale or claim support a package never declared.

The strictness lives in one flag. Under CI a registry that does not answer
fails the build, because a listing that silently drops a plugin is worse than
no deploy. Locally an unpublished package falls back to scripts/preview.mjs and
says so — a site nobody can look at until its packages ship is a site nobody
can design. The three seed plugins are unpublished today, so that fallback is
what renders them; it goes away with them.

Every card shows all four runtimes, never only the supported ones. Colour means
the package declares it runs there, dim grey means it does not — and the
tooltip is what separates "declared unsupported" from "nobody said", which look
identical but are not the same fact.

The brand marks carry no <title>: an SVG's own title wins over its parent's,
which is why the first attempt showed a help cursor and no tooltip. They are
aria-hidden and pointer-events: none, so the label and the hover both belong to
the list item, and the tooltip works from the keyboard too.

Type and palette are self-hosted from green-tea-site, so the sites read as one
project rather than three that share a colour.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-09-20 12:44:06 -05:00
commit 3ee6928d94
24 files changed
+5203

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
dist
node_modules
.astro
.DS_Store
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 green-tea contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+80
View File
@@ -0,0 +1,80 @@
# green-tea-marketplace
The plugin listing for [green-tea](https://github.com/Expressive-Tea/green-tea), served at
<https://green-tea.expressive-tea.io/plugins>.
One YAML file per plugin under `src/content/plugins/`. Versions and runtimes are **not** stored
here — they are read from npm and JSR when the site is built, so a card cannot go stale or claim
support a package never declared.
```yaml
npm: "@green-tea/jwt" # at least one of npm / jsr
jsr: "@green-tea/jwt"
repo: https://github.com/Expressive-Tea/green-tea-plugins
description: "One sentence, 20–200 characters."
```
Naming is enforced by the content collection's schema, so a wrongly-named entry fails the build:
| | npm | JSR |
|---|---|---|
| Internal | `@green-tea/<x>` | `@green-tea/<x>` |
| Third party | `green-tea-<x>` or `@scope/green-tea-<x>` | `@scope/green-tea-<x>` |
## Commands
```bash
npm run dev # http://localhost:4321/plugins
npm run build # static output in dist/
npm test # the deploy script's self-test; no network
npm run deploy # build, then upload — see below
```
## Live data, and why a local build still works
`scripts/registry.mjs` reads npm and JSR at build time.
- **With `CI=true`** — a registry that does not answer **fails the build**. A listing that silently
drops a plugin, or shows last month's version, is worse than no deploy.
- **Locally** — an unpublished package falls back to `scripts/preview.mjs` and logs a line saying
so, because a site nobody can look at until its packages ship is a site nobody can design.
`scripts/preview.mjs` is temporary. **Delete it, and its import in `src/pages/index.astro`, once
`@green-tea/jwt`, `@green-tea/metrics` and `@green-tea/rate-limit` are published.**
## Deploy
By hand, from a maintainer's machine. The key authenticates as the whole cPanel account, so it is
never a CI secret.
```bash
DEPLOY_REMOTE=green-tea.expressive-tea.io/plugins \
DEPLOY_HOST=user@host \
npm run deploy
```
`npm run deploy -- --dry-run` prints the SFTP batch without sending anything.
Two things that account forces, which no error message will explain:
- **Uploads never delete.** That docroot holds `.well-known/acme-challenge`; a blind delete takes
the certificate renewal with it. Old hashed assets simply accumulate.
- **`.htaccess` never travels from `dist/`.** The one on the server carries cPanel's generated PHP
handler block, which is not in this repository.
**Before the first deploy**, create the directory by hand — `deploy.mjs` starts with `cd` and fails
if the target does not exist:
```bash
sftp -i ~/.ssh/expressive-tea-cpanel user@host
sftp> cd green-tea.expressive-tea.io
sftp> mkdir plugins
sftp> bye
```
Cadence: **Friday**, when something merged that week.
## Not here yet
CI (`validate.mjs` and the GitHub Actions workflow that runs the registry checks on every pull
request) lands after the initial deploy.
+11
View File
@@ -0,0 +1,11 @@
// @ts-check
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
// One page, no MDX. The long-form writing about plugins lives in green-tea-docs; this site only
// answers "what exists, where does it run, where do I get it".
export default defineConfig({
site: 'https://green-tea.expressive-tea.io',
base: '/plugins',
integrations: [sitemap()],
});
+4186
View File
File diff suppressed because it is too large. Load diff
+21
View File
@@ -0,0 +1,21 @@
{
"name": "green-tea-marketplace",
"type": "module",
"private": true,
"version": "26.9.0",
"engines": {
"node": ">=22.12.0"
},
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"test": "node scripts/deploy.mjs --self-test",
"deploy": "npm run build && node scripts/deploy.mjs",
"astro": "astro"
},
"dependencies": {
"@astrojs/sitemap": "^3.7.3",
"astro": "^7.1.6"
}
}
+93
View File
@@ -0,0 +1,93 @@
Copyright 2021 The Zen Maru Gothic Project Authors (https://github.com/googlefonts/zen-marugothic)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
+105
View File
@@ -0,0 +1,105 @@
#!/usr/bin/env node
// Sube dist/ al docroot de cPanel por SFTP.
//
// El shell remoto está deshabilitado en esa cuenta, así que rsync, tar y cualquier
// comando remoto están descartados: `sftp -b` es el único canal. Eso trae dos
// consecuencias que este script asume en vez de intentar resolver:
// - No borra nada. Los assets con hash viejos y las páginas que dejaron de
// existir se quedan ahí. Es basura inofensiva; borrar a ciegas en ese docroot
// se llevaría .well-known/acme-challenge y con él la renovación del certificado.
// - No hay swap atómico, de ahí el orden de subida (ver buildBatch).
import { readdirSync, existsSync } from 'node:fs';
import { spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
import { join, relative, dirname } from 'node:path';
import assert from 'node:assert/strict';
// El destino sale del entorno, no del repositorio. No es un secreto — la llave privada
// nunca ha estado aquí y el acceso es sólo por clave — pero un usuario de cPanel escrito
// en un repo público es la mitad de un par de credenciales y un objetivo confirmado, a
// cambio de nada. Se leen tarde, dentro del deploy, para que `--self-test` siga corriendo
// en CI sin necesidad de configurarlas.
const REMOTE = process.env.DEPLOY_REMOTE ?? 'public_html';
const DIST = fileURLToPath(new URL('../dist/', import.meta.url));
/**
* Rutas relativas a dist/ -> batch de sftp. Puro a propósito: el orden es lo único
* delicado que hay aquí, y así se puede probar sin tocar ni el disco ni la red.
*/
export function buildBatch(paths) {
// .htaccess nunca viaja desde dist/. El que está en el servidor lleva además el
// bloque de handlers que genera cPanel (ea-php81 en el apex, distinto por dominio),
// y ese bloque no está en el repo: subir el de dist/ le cambiaría la versión de PHP
// al dominio principal en silencio.
const files = paths.filter((p) => p !== '.htaccess');
// Cada ruta aporta toda su cadena de ancestros: `mkdir` no crea padres, así que
// blog/2026/post.html necesita `blog` antes que `blog/2026`.
const ancestors = (p) => dirname(p).split('/').map((_, i, a) => a.slice(0, i + 1).join('/'));
const dirs = [...new Set(files.flatMap(ancestors))]
.filter((d) => d !== '.')
.sort((a, b) => a.split('/').length - b.split('/').length || a.localeCompare(b));
// HTML al final: sin swap atómico, hay una ventana en la que el HTML nuevo ya está
// servido y sus assets no han llegado. Subiendo el HTML de último la ventana existe
// al revés — HTML viejo, assets nuevos — que nadie nota.
const isHtml = (p) => p.endsWith('.html');
return [
`cd ${REMOTE}`,
`lcd ${DIST}`,
...dirs.map((d) => `-mkdir ${d}`), // el '-' deja continuar si ya existe
...files.filter((p) => !isHtml(p)).map((p) => `put ${p} ${p}`),
...files.filter(isHtml).map((p) => `put ${p} ${p}`),
'bye',
].join('\n');
}
function walk(dir, base = dir) {
return readdirSync(dir, { withFileTypes: true }).flatMap((e) => {
const p = join(dir, e.name);
return e.isDirectory() ? walk(p, base) : [relative(base, p)];
});
}
function selfTest() {
const batch = buildBatch(['index.html', '.htaccess', 'og.png', 'blog/x/index.html', '_astro/a.css']);
const at = (line) => {
const i = batch.split('\n').indexOf(line);
assert.notEqual(i, -1, `falta la línea: ${line}`);
return i;
};
assert.ok(!batch.includes('.htaccess'), '.htaccess no debe viajar desde dist/');
assert.ok(at('-mkdir blog') < at('-mkdir blog/x'), 'los directorios padre van primero');
assert.ok(at('-mkdir blog/x') < at('put blog/x/index.html blog/x/index.html'), 'mkdir antes del put');
assert.ok(at('put og.png og.png') < at('put index.html index.html'), 'el HTML se sube al final');
console.log('deploy self-test ok');
}
if (process.argv.includes('--self-test')) {
selfTest();
} else {
if (!existsSync(DIST)) {
console.error('No hay dist/. Corre `npm run build` primero.');
process.exit(1);
}
const paths = walk(DIST);
if (paths.includes('.htaccess')) {
console.error('nota: dist/.htaccess no se sube. Si cambiaron las redirecciones, súbelo a mano');
console.error(' con el bloque PHP de cPanel ya mezclado (ver README).\n');
}
const batch = buildBatch(paths);
console.log(batch);
if (!process.argv.includes('--dry-run')) {
const host = process.env.DEPLOY_HOST;
const key = process.env.DEPLOY_KEY ?? `${process.env.HOME}/.ssh/expressive-tea-cpanel`;
if (!host) {
console.error('Falta DEPLOY_HOST (usuario@host del cPanel). Ver README.');
console.error(' DEPLOY_HOST=usuario@dominio npm run deploy');
process.exit(2);
}
if (!existsSync(key)) {
console.error(`No existe la clave ${key}. Pon la ruta en DEPLOY_KEY si vive en otro sitio.`);
process.exit(2);
}
const r = spawnSync('sftp', ['-i', key, '-b', '-', host], { input: batch, stdio: ['pipe', 'inherit', 'inherit'] });
process.exit(r.status ?? 1);
}
}
+14
View File
@@ -0,0 +1,14 @@
// 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' } },
};
+138
View File
@@ -0,0 +1,138 @@
// Every registry call lives here, and both the validator and the site build import it. One
// implementation on purpose: if the check that gates a merge and the data that renders a card came
// from two readers, a plugin could pass validation and then render wrong.
/** The four runtimes, in the order every card shows them. */
export const RUNTIMES = Object.freeze(['node', 'deno', 'bun', 'workerd']);
/**
* Where the strictness lives.
*
* 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.
*/
export const STRICT = process.env.CI === 'true';
/** Compare two semver strings. Enough for CalVer + `-beta.N`; no dependency for a dozen lines. */
function compare(a, b) {
const split = (v) => {
const [core, pre] = v.split('-');
return [core.split('.').map(Number), pre ? pre.split('.') : null];
};
const [an, ap] = split(a);
const [bn, bp] = split(b);
for (let i = 0; i < 3; i += 1) if (an[i] !== bn[i]) return an[i] - bn[i];
// A release outranks its own prerelease: 1.0.0 > 1.0.0-beta.1.
if (!ap && !bp) return 0;
if (!ap) return 1;
if (!bp) return -1;
for (let i = 0; i < Math.max(ap.length, bp.length); i += 1) {
const x = ap[i];
const y = bp[i];
if (x === y) continue;
if (x === undefined) return -1;
if (y === undefined) return 1;
const numeric = /^\d+$/.test(x) && /^\d+$/.test(y);
return numeric ? Number(x) - Number(y) : String(x).localeCompare(String(y));
}
return 0;
}
/**
* The newest of a version list.
*
* Never npm's `dist-tags.latest` and never JSR's `latest`: JSR returns `null` there while a
* package has only prereleases, which is every green-tea package today — verified against
* `@green-tea/core`, which has two published versions and `"latest": null`.
*/
export function newestVersion(versions) {
return [...versions].sort(compare).pop();
}
async function getJson(url, what) {
const response = await fetch(url, { headers: { accept: 'application/json' } });
if (!response.ok) throw new Error(`${what}: ${url} answered ${response.status}`);
return response.json();
}
/** The npm packument, reduced to what validation and the card need. */
export async function readNpm(name) {
const packument = await getJson(`https://registry.npmjs.org/${name.replace('/', '%2f')}`, `npm ${name}`);
const versions = Object.keys(packument.versions ?? {});
const newest = newestVersion(versions);
const version = newest ? packument.versions[newest] : {};
return {
versions,
newest,
description: version.description ?? '',
engines: version.engines ?? {},
// All three maps: a check treats core in `devDependencies` as correct and core in
// `dependencies` or `peerDependencies` as a convention smell worth a warning, so it has to be
// able to tell them apart rather than just miss it.
devDependencies: version.devDependencies ?? {},
dependencies: version.dependencies ?? {},
peerDependencies: version.peerDependencies ?? {},
};
}
/** JSR, reduced the same way. Three calls, because JSR splits what npm returns in one document. */
export async function readJsr(name) {
const [scope, pkg] = name.replace(/^@/, '').split('/');
const base = `https://api.jsr.io/scopes/${scope}/packages/${pkg}`;
const info = await getJson(base, `jsr ${name}`);
const listing = await getJson(`${base}/versions`, `jsr ${name} versions`);
// `items`, not `latestVersion`. See newestVersion.
const versions = (listing.items ?? []).map((item) => item.version);
const newest = newestVersion(versions);
const dependencies = newest ? await getJson(`${base}/versions/${newest}/dependencies`, `jsr ${name} deps`) : [];
return { versions, newest, runtimeCompat: info.runtimeCompat ?? {}, dependencies };
}
/**
* Which of the four runtimes a package declares.
*
* npm says it in `engines`, which also carries non-runtime keys like `npm` — hence the filter
* against RUNTIMES rather than taking every key. JSR says it in `runtimeCompat`, where `false` is
* a declaration that it does *not* run there and must never be read as support.
*/
export function declaredRuntimes({ engines, runtimeCompat }) {
if (runtimeCompat && Object.keys(runtimeCompat).length > 0) {
return RUNTIMES.filter((runtime) => runtimeCompat[runtime] === true);
}
return RUNTIMES.filter((runtime) => engines?.[runtime] !== undefined);
}
/**
* Everything one card needs, live where possible.
*
* 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.
*/
export async function readEntry(entry, preview) {
try {
const npm = entry.npm ? await readNpm(entry.npm) : undefined;
const jsr = entry.jsr ? await readJsr(entry.jsr) : undefined;
return {
version: (npm ?? jsr).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 }),
live: true,
};
} 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}`);
return { version: fallback.version, runtimes: declaredRuntimes({ engines: fallback.engines }), live: false };
}
}
+83
View File
@@ -0,0 +1,83 @@
---
import { RUNTIMES } from '../../scripts/registry.mjs';
// Brand marks from simple-icons (CC0), vendored rather than pulled at build time. `?raw` inlines
// them so each is one path in the HTML instead of four more requests.
import node from '../icons/nodedotjs.svg?raw';
import deno from '../icons/deno.svg?raw';
import bun from '../icons/bun.svg?raw';
import workerd from '../icons/cloudflareworkers.svg?raw';
interface Props {
name: string;
description: string;
repo: string;
version: string;
npm?: string;
jsr?: string;
runtimes: string[];
internal: boolean;
}
const { name, description, repo, version, npm, jsr, runtimes, internal } = Astro.props;
const ICONS: Record<string, string> = { node, deno, bun, workerd };
const LABELS: Record<string, string> = {
node: 'Node.js',
deno: 'Deno',
bun: 'Bun',
workerd: 'workerd (Cloudflare Workers)',
};
// All four are always shown. Colour means the package declares it runs there; dim grey means it
// declared otherwise, or said nothing — the tooltip is what separates those two, because at a
// glance they are the same fact: you cannot use it there.
const runs = (runtime: string) => runtimes.includes(runtime);
const tooltip = (runtime: string) => {
if (runs(runtime)) return `Runs on ${LABELS[runtime]}`;
return internal
? `Does not run on ${LABELS[runtime]} — see the README for why`
: `${LABELS[runtime]} not declared by this package`;
};
---
<article class="card">
<span class="version">{version}</span>
<h2>{name}</h2>
<ul class="runtimes">
{
RUNTIMES.map((runtime) => (
// `data-tip` rather than `title`: the native tooltip waits about a second, cannot be
// styled, and — the reason it did not work at all here — loses to a `<title>` inside the
// SVG. The marks now carry no `<title>`, and the label lives on this element for both the
// tooltip and the screen reader. `tabindex` so it is reachable without a mouse.
<li
class={runs(runtime) ? 'yes' : 'no'}
data-tip={tooltip(runtime)}
role="img"
aria-label={tooltip(runtime)}
tabindex="0"
>
<Fragment set:html={ICONS[runtime]} />
</li>
))
}
</ul>
<p>{description}</p>
<p class="links">
{npm && <a href={`https://www.npmjs.com/package/${npm}`}>npm</a>}
{jsr && <a href={`https://jsr.io/${jsr}`}>JSR</a>}
<a href={repo}>source</a>
</p>
{
internal && (
<p class="why">
<a href={`${repo}#runtimes`}>why not the others</a>
</p>
)
}
</article>
+28
View File
@@ -0,0 +1,28 @@
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';
// Naming, from spec 5.2. Enforced here so a wrongly-named submission is rejected by the build
// rather than by a reviewer's memory.
// internal npm @green-tea/<x> JSR @green-tea/<x>
// third party npm green-tea-<x> or @scope/green-tea-<x>
const NPM_NAME = /^(@green-tea\/[a-z0-9-]+|green-tea-[a-z0-9-]+|@[a-z0-9-]+\/green-tea-[a-z0-9-]+)$/;
const JSR_NAME = /^@[a-z0-9-]+\/(green-tea-)?[a-z0-9-]+$/;
const plugins = defineCollection({
loader: glob({ pattern: '**/[^_]*.yaml', base: './src/content/plugins' }),
schema: z
.object({
// `npm` and `jsr` rather than one `name`: a third party's package has a different name on
// each registry. No `version` and no `runtimes` — both come from the registry, so an entry
// cannot go stale or claim a runtime the package never declared.
npm: z.string().regex(NPM_NAME, 'npm name must be @green-tea/<x>, green-tea-<x> or @scope/green-tea-<x>').optional(),
jsr: z.string().regex(JSR_NAME, 'JSR name must be @scope/<x>').optional(),
repo: z.string().url(),
description: z.string().min(20).max(200),
})
.refine((entry) => entry.npm ?? entry.jsr, {
message: 'an entry needs at least one of npm / jsr — otherwise there is nothing to install',
}),
});
export const collections = { plugins };
+4
View File
@@ -0,0 +1,4 @@
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."
+4
View File
@@ -0,0 +1,4 @@
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."
+4
View File
@@ -0,0 +1,4 @@
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."
+1
View File
@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 22.596c6.628 0 12-4.338 12-9.688 0-3.318-2.057-6.248-5.219-7.986-1.286-.715-2.297-1.357-3.139-1.89C14.058 2.025 13.08 1.404 12 1.404c-1.097 0-2.334.785-3.966 1.821a49.92 49.92 0 0 1-2.816 1.697C2.057 6.66 0 9.59 0 12.908c0 5.35 5.372 9.687 12 9.687v.001ZM10.599 4.715c.334-.759.503-1.58.498-2.409 0-.145.202-.187.23-.029.658 2.783-.902 4.162-2.057 4.624-.124.048-.199-.121-.103-.209a5.763 5.763 0 0 0 1.432-1.977Zm2.058-.102a5.82 5.82 0 0 0-.782-2.306v-.016c-.069-.123.086-.263.185-.172 1.962 2.111 1.307 4.067.556 5.051-.082.103-.23-.003-.189-.126a5.85 5.85 0 0 0 .23-2.431Zm1.776-.561a5.727 5.727 0 0 0-1.612-1.806v-.014c-.112-.085-.024-.274.114-.218 2.595 1.087 2.774 3.18 2.459 4.407a.116.116 0 0 1-.049.071.11.11 0 0 1-.153-.026.122.122 0 0 1-.022-.083 5.891 5.891 0 0 0-.737-2.331Zm-5.087.561c-.617.546-1.282.76-2.063 1-.117 0-.195-.078-.156-.181 1.752-.909 2.376-1.649 2.999-2.778 0 0 .155-.118.188.085 0 .304-.349 1.329-.968 1.874Zm4.945 11.237a2.957 2.957 0 0 1-.937 1.553c-.346.346-.8.565-1.286.62a2.178 2.178 0 0 1-1.327-.62 2.955 2.955 0 0 1-.925-1.553.244.244 0 0 1 .064-.198.234.234 0 0 1 .193-.069h3.965a.226.226 0 0 1 .19.07c.05.053.073.125.063.197Zm-5.458-2.176a1.862 1.862 0 0 1-2.384-.245 1.98 1.98 0 0 1-.233-2.447c.207-.319.503-.566.848-.713a1.84 1.84 0 0 1 1.092-.11c.366.075.703.261.967.531a1.98 1.98 0 0 1 .408 2.114 1.931 1.931 0 0 1-.698.869v.001Zm8.495.005a1.86 1.86 0 0 1-2.381-.253 1.964 1.964 0 0 1-.547-1.366c0-.384.11-.76.32-1.079.207-.319.503-.567.849-.713a1.844 1.844 0 0 1 1.093-.108c.367.076.704.262.968.534a1.98 1.98 0 0 1 .4 2.117 1.932 1.932 0 0 1-.702.868Z"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

+1
View File
@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m8.213.063 8.879 12.136-8.67 11.739h2.476l8.665-11.735-8.89-12.14Zm4.728 0 9.02 11.992-9.018 11.883h2.496L24 12.656v-1.199L15.434.063ZM7.178 2.02.01 11.398l-.01 1.2 7.203 9.644 1.238-1.676-6.396-8.556 6.361-8.313Z"/></svg>

After

Width:  |  Height:  |  Size: 328 B

+1
View File
@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771 12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774 12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305 12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437-.455-.197-1.04-.624-1.226-.829-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35.66.111 1.484.25 2.317.292 2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19 12 12 0 0 1-1.25-1.634 12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236.13.979-.228 1.99-1.41 2.013-1.01.02-1.315-.997-1.248-1.614.066-.616.574-1.575 1.35-1.635"/></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

+1
View File
@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

+75
View File
@@ -0,0 +1,75 @@
---
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 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.
const entries = await getCollection('plugins');
const plugins = await Promise.all(
entries.map(async (entry) => {
const { version, runtimes } = await readEntry(entry.data, PREVIEW);
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/'),
};
}),
);
plugins.sort((a, b) => a.name.localeCompare(b.name));
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>green-tea plugins</title>
<meta name="description" content="Plugins for green-tea, with the runtimes each one declares." />
<link rel="canonical" href="https://green-tea.expressive-tea.io/plugins" />
</head>
<body>
<div class="wrap">
<header>
<h1>green-tea <em>plugins</em></h1>
<p>
A plugin is a named object that adds steps and providers to your graph. It imports green-tea
as types only, so installing one never pulls a second copy of core.
</p>
<p>
<a href="https://github.com/Expressive-Tea/green-tea-marketplace/blob/main/CONTRIBUTING.md">
Add your plugin &rarr;
</a>
</p>
<p class="requires">
Everything here needs <code>@green-tea/core@26.9.0-beta.2</code> or newer. That is the
release where a plugin became <code>&#123; name, mount &#125;</code> and <code>app.boot()</code>
went public; on anything older these will not mount.
</p>
</header>
<div class="grid">
{plugins.map((plugin) => <PluginCard {...plugin} />)}
</div>
<footer>
<p>
Part of <a href="https://expressive-tea.io">Expressive Tea</a> &middot;
<a href="https://green-tea.expressive-tea.io">green-tea</a> &middot;
<a href="https://github.com/Expressive-Tea/green-tea-marketplace">this listing on GitHub</a>
</p>
</footer>
</div>
</body>
</html>
+327
View File
@@ -0,0 +1,327 @@
/* Type and palette are green-tea-site's, self-hosted the same way, so the sites read as one
project rather than as three that happen to share a colour. */
@font-face {
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('/plugins/fonts/zen-maru-gothic-latin-500.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('/plugins/fonts/zen-maru-gothic-latin-700.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
--base: #0d1117;
--panel: #161b22;
--line: #21262d;
--matcha: #5fb88a;
--matcha-deep: #3fa873;
--violet: #7c6cf0;
--ink: #e6edf3;
--dim: #8b949e;
--font-heading: 'Zen Maru Gothic', var(--font-body);
--font-body:
-apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
--font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;
--max-width: 1120px;
--gutter: 24px;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--base);
color: var(--ink);
font-family: var(--font-body);
line-height: 1.6;
}
h1,
h2,
h3 {
font-family: var(--font-heading);
font-weight: 700;
}
.wrap {
max-width: var(--max-width);
margin: 0 auto;
padding: 64px var(--gutter) 96px;
}
header h1 {
font-size: clamp(2rem, 5vw, 3rem);
margin: 0 0 12px;
letter-spacing: -0.01em;
}
header h1 em {
color: var(--matcha);
font-style: normal;
}
header p {
color: var(--dim);
max-width: 62ch;
margin: 0 0 16px;
}
header a {
color: var(--matcha);
}
/* The one thing a reader has to know before installing anything here. */
.requires {
margin: 24px 0 0;
padding: 12px 16px;
border-left: 3px solid var(--violet);
background: rgba(124, 108, 240, 0.07);
color: var(--dim);
font-size: 0.9rem;
}
.requires code {
font-family: var(--font-mono);
color: var(--ink);
}
.grid {
display: grid;
gap: 20px;
grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
margin-top: 40px;
}
.card {
position: relative;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 12px;
padding: 22px 24px 18px;
display: flex;
flex-direction: column;
gap: 12px;
}
.card h2 {
margin: 0;
/* Room for the version pinned to the corner, so a long name wraps instead of running under it. */
padding-right: 104px;
font-family: var(--font-mono);
font-size: 1.05rem;
font-weight: 500;
word-break: break-word;
}
.version {
position: absolute;
top: 18px;
right: 18px;
padding: 3px 9px;
border-radius: 999px;
background: rgba(95, 184, 138, 0.12);
border: 1px solid rgba(95, 184, 138, 0.3);
color: var(--matcha);
font-family: var(--font-mono);
font-size: 0.72rem;
font-weight: 600;
white-space: nowrap;
}
/* Runs-on, directly under the title. Colour means it runs there; grey means it does not. */
.runtimes {
list-style: none;
margin: 0;
padding: 0;
display: flex;
gap: 10px;
}
.runtimes li {
position: relative;
display: flex;
width: 30px;
height: 30px;
align-items: center;
justify-content: center;
border-radius: 8px;
border: 1px solid var(--line);
cursor: help;
}
.runtimes svg {
width: 17px;
height: 17px;
fill: currentColor;
/* The hover target is always the <li>. Without this the pointer lands on the mark instead and
the tooltip below never fires. */
pointer-events: none;
}
/* A real tooltip, not the native one: instant, styled, and it cannot be hijacked by anything
inside the icon. */
.runtimes li::after {
content: attr(data-tip);
position: absolute;
bottom: calc(100% + 9px);
left: 50%;
transform: translateX(-50%) translateY(4px);
z-index: 2;
width: max-content;
max-width: 220px;
padding: 7px 10px;
border-radius: 7px;
border: 1px solid var(--line);
background: #0b0f14;
color: var(--ink);
font-family: var(--font-body);
font-size: 0.74rem;
font-weight: 400;
line-height: 1.4;
text-align: center;
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
opacity: 0;
pointer-events: none;
transition:
opacity 120ms ease,
transform 120ms ease;
}
/* The arrow. A rotated square is one element fewer than a border triangle and inherits the
tooltip's own border. */
.runtimes li::before {
content: '';
position: absolute;
bottom: calc(100% + 5px);
left: 50%;
z-index: 3;
width: 8px;
height: 8px;
background: #0b0f14;
border-right: 1px solid var(--line);
border-bottom: 1px solid var(--line);
transform: translateX(-50%) rotate(45deg) translateY(4px);
opacity: 0;
pointer-events: none;
transition:
opacity 120ms ease,
transform 120ms ease;
}
.runtimes li:hover::after,
.runtimes li:focus-visible::after {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
.runtimes li:hover::before,
.runtimes li:focus-visible::before {
opacity: 1;
transform: translateX(-50%) rotate(45deg) translateY(0);
}
.runtimes li:focus-visible {
outline: 2px solid var(--matcha);
outline-offset: 2px;
}
/* An unsupported mark is dimmed, but its tooltip has to stay readable — the opacity sits on the
list item, so lift it back on the tooltip. */
.runtimes .no::after,
.runtimes .no::before {
opacity: 0;
}
.runtimes .no:hover,
.runtimes .no:focus-visible {
opacity: 1;
}
.runtimes .no:hover svg,
.runtimes .no:focus-visible svg {
opacity: 0.45;
}
.runtimes .yes {
color: var(--matcha);
border-color: rgba(95, 184, 138, 0.35);
background: rgba(95, 184, 138, 0.09);
}
/* Dim grey, and only 45% opaque: unsupported should read as absent at a glance, not as a second
kind of support. */
.runtimes .no {
color: #6e7681;
opacity: 0.45;
}
.card > p {
margin: 0;
color: var(--dim);
flex: 1;
}
.links {
margin: 4px 0 0;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.links a {
color: var(--matcha);
text-decoration: none;
border: 1px solid var(--line);
border-radius: 6px;
padding: 4px 11px;
font-size: 0.8rem;
}
.links a:hover {
border-color: var(--matcha-deep);
}
.why {
margin: 4px 0 0;
text-align: center;
font-size: 0.78rem;
}
.why a {
color: var(--dim);
text-decoration: none;
border-bottom: 1px dotted var(--line);
}
.why a:hover {
color: var(--matcha);
}
footer {
margin-top: 64px;
padding-top: 24px;
border-top: 1px solid var(--line);
color: var(--dim);
font-size: 0.85rem;
}
footer a {
color: var(--matcha);
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "astro/tsconfigs/strict" }