diff --git a/src/components/sections/FrontRow.astro b/src/components/sections/FrontRow.astro new file mode 100644 index 0000000..5509b5d --- /dev/null +++ b/src/components/sections/FrontRow.astro @@ -0,0 +1,47 @@ +--- +import { ADD_URL, CONTRIBUTING_URL } from '../../links'; +--- + +
+
+

The listing is new. The first plugins get the front row.

+

Every plugin here today is one of ours. The first community entries are the ones people will see first.

+

+ Add your plugin + Read CONTRIBUTING.md +

+
+
+ + diff --git a/src/components/sections/Hero.astro b/src/components/sections/Hero.astro new file mode 100644 index 0000000..b272480 --- /dev/null +++ b/src/components/sections/Hero.astro @@ -0,0 +1,121 @@ +--- +import { Code } from 'astro:components'; +import { ADD_URL } from '../../links'; + +// A whole plugin, written against the real `Plugin` type in core (src/plugin.ts). If that type +// changes, this has to change with it — it is the first thing a plugin author reads. +const SAMPLE = `import type { Plugin } from '@green-tea/core'; + +export function greeting(text = 'hello'): Plugin { + return { + name: 'greeting', + mount({ scope }) { + scope.add({ + kind: 'provider', + name: 'greeting', + needs: [], + provides: ['greeting'], + run: () => ({ greeting: text }), + }); + }, + }; +}`; +--- + +
+
+
+

Green Tea. plugins

+

Write it once. It mounts in any green-tea app.

+

+ A plugin is a name and a mount function. It adds providers and steps to the graph, and + green-tea figures out where they run. Publish it to JSR or npm, list it here, and it gets a + page of its own. +

+

+ Add your plugin + Browse plugins +

+

Node · Deno · Bun · workerd

+
+ +
+
greeting.ts
+ +
+
+
+ + diff --git a/src/components/sections/HowItWorks.astro b/src/components/sections/HowItWorks.astro new file mode 100644 index 0000000..19f7602 --- /dev/null +++ b/src/components/sections/HowItWorks.astro @@ -0,0 +1,89 @@ +--- +import { Code } from 'astro:components'; +import { EXAMPLE_ENTRY } from '../../links'; + +// The editor gets the comment that explains npm; the card is too narrow for it. +const shown = EXAMPLE_ENTRY.replace(/[ \t]+#.*$/m, '').trim(); +--- + +
+

How it works

+

Three steps

+ +
    +
  1. +

    Publish

    +

    Put it on JSR, or on npm as an ESM-only package.

    +
  2. +
  3. +

    Add one file

    +

    Open a pull request that adds one yaml file.

    + +
  4. +
  5. +

    Go live

    +

    Once it merges, it is out on the next Friday cut.

    +
  6. +
+
+ + diff --git a/src/components/sections/WhatIsAPlugin.astro b/src/components/sections/WhatIsAPlugin.astro new file mode 100644 index 0000000..8038bd4 --- /dev/null +++ b/src/components/sections/WhatIsAPlugin.astro @@ -0,0 +1,74 @@ +--- +// Every claim here is checked against core: the shape and the three-method API are +// `Plugin`/`PluginApi` in src/plugin.ts, and `mountPlugin` hands over nothing else, which is why a +// plugin cannot reorder or remove what an app already has. +const points = [ + { + title: 'One object', + body: '{ name, mount }. No base class to extend and no lifecycle to learn. mount gets bus.on, scope.add and onShutdown, and that is the whole API.', + }, + { + title: 'Core as types only', + body: 'Plugins import @green-tea/core with import type. Installing one never pulls in a second copy of core, so there is no version to line up.', + }, + { + title: 'The graph picks the order', + body: 'Say what your plugin needs and what it provides, and green-tea decides where it runs. A plugin can add to an app, but it cannot reorder or remove anything that is already there.', + }, +]; +--- + +
+

The idea

+

What's a plugin, and why write one?

+ +
+ { + points.map((point, i) => ( +
+ +

{point.title}

+

+

+ )) + } +
+
+ + diff --git a/src/components/sections/WhyHere.astro b/src/components/sections/WhyHere.astro new file mode 100644 index 0000000..22c5c11 --- /dev/null +++ b/src/components/sections/WhyHere.astro @@ -0,0 +1,55 @@ +--- +// Nothing here promises traffic or reach. Each line is something the listing already does. +const reasons = [ + { title: 'A page of its own', body: 'Your README, every published version and an install command people can copy.' }, + { title: 'Runtimes read, not typed', body: 'Each card shows where your plugin runs, taken from what the package declares.' }, + { + title: "It doesn't go stale", + body: 'Your entry has no version in it. Every build asks the registry, so a new release shows up at the next cut without another pull request.', + }, + { title: 'Read by a person', body: 'Someone who works on green-tea reads each entry before it is listed.' }, +]; +--- + +
+

Why here

+

Why list it here

+ +
+ { + reasons.map((reason) => ( +
+
{reason.title}
+
{reason.body}
+
+ )) + } +
+
+ + diff --git a/src/links.ts b/src/links.ts new file mode 100644 index 0000000..47ce31e --- /dev/null +++ b/src/links.ts @@ -0,0 +1,13 @@ +// Links more than one section needs. The GitHub repo does not exist yet, so these 404 until it does. + +/** What "Add your plugin" pre-fills in GitHub's new-file editor. */ +export const EXAMPLE_ENTRY = `jsr: "@your-scope/green-tea-your-plugin" # recommended. Or npm: green-tea-your-plugin (ESM only) +repo: https://github.com/you/green-tea-your-plugin +description: "One sentence, 20 to 200 characters." +`; + +// GitHub's new-file editor, inside this repo, with the example already filled in: a contributor +// edits a few lines and opens the pull request from there. +export const ADD_URL = `https://github.com/Expressive-Tea/green-tea-marketplace/new/main/src/content/plugins?filename=green-tea-your-plugin.yaml&value=${encodeURIComponent(EXAMPLE_ENTRY)}`; + +export const CONTRIBUTING_URL = 'https://github.com/Expressive-Tea/green-tea-marketplace/blob/main/CONTRIBUTING.md'; diff --git a/src/pages/index.astro b/src/pages/index.astro index 11bb395..e05f7b9 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -3,6 +3,11 @@ import { getCollection } from 'astro:content'; import Header from '../components/Header.astro'; import Footer from '../components/Footer.astro'; import PluginCard from '../components/PluginCard.astro'; +import Hero from '../components/sections/Hero.astro'; +import WhatIsAPlugin from '../components/sections/WhatIsAPlugin.astro'; +import WhyHere from '../components/sections/WhyHere.astro'; +import HowItWorks from '../components/sections/HowItWorks.astro'; +import FrontRow from '../components/sections/FrontRow.astro'; import '../styles/global.css'; // Read at build time by the collection's loader (scripts/loader.mjs) — this site is static files @@ -21,14 +26,6 @@ const plugins = (await getCollection('plugins')) internal: (data.jsr ?? data.npm ?? '').startsWith('@green-tea/'), })) .sort((a, b) => a.name.localeCompare(b.name)); -// "Add your plugin" opens GitHub's new-file editor inside this repo with an example already -// filled in, so a contributor edits a few lines and opens the pull request from there. -const EXAMPLE = `jsr: "@your-scope/green-tea-your-plugin" # recommended. Or npm: green-tea-your-plugin (ESM only) -repo: https://github.com/you/green-tea-your-plugin -description: "One sentence, 20 to 200 characters." -`; -const ADD_URL = `https://github.com/Expressive-Tea/green-tea-marketplace/new/main/src/content/plugins?filename=green-tea-your-plugin.yaml&value=${encodeURIComponent(EXAMPLE)}`; -const CONTRIBUTING = 'https://github.com/Expressive-Tea/green-tea-marketplace/blob/main/CONTRIBUTING.md'; --- @@ -44,33 +41,21 @@ const CONTRIBUTING = 'https://github.com/Expressive-Tea/green-tea-marketplace/bl
-
-

Built a green-tea plugin? List it here.

-

- Publish it to JSR (our recommendation) or to npm as ESM only. Then add one small file to - this repo, and it shows up on the next Friday cut. -

-

- Add your plugin - Browse plugins -

-
+ + -
+
+

The listing

+

Official plugins, and room for yours

+

Three to start. The version and runtimes on each card come straight from the registry.

{plugins.map((plugin) => )}
-
-

How it works

-
    -
  1. Publish to JSR, or to npm as an ESM-only package.
  2. -
  3. Open a pull request that adds one yaml file.
  4. -
  5. When it merges, it goes live the next Friday.
  6. -
-

What counts as a plugin, and what a reviewer checks, is in CONTRIBUTING.md.

-
+ + +