Compare commits
36
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a97ed9fb20 | ||
|
|
cd70472367 | ||
|
|
fb1e356ccc | ||
|
|
7debd362f1 | ||
|
|
17e7abf1c0 | ||
|
|
6437289977 | ||
|
|
b573a0d553 | ||
|
|
af22bf7f77 | ||
|
|
4b91f67e15 | ||
|
|
2e2326b11e | ||
|
|
7ebf194d16 | ||
|
|
0ef916bf56 | ||
|
|
a97a137136 | ||
|
|
96a0412531 | ||
|
|
a860c04741 | ||
|
|
70b96dc8a5 | ||
|
|
78fcec0283 | ||
|
|
264ca63833 | ||
|
|
464cd5309e | ||
|
|
b05a6c4fa8 | ||
|
|
d24243b23f | ||
|
|
771617930e | ||
|
|
750e268a9f | ||
|
|
f7473d0338 | ||
|
|
9a34ab0699 | ||
|
|
b978dacd4f | ||
|
|
a92cc0f82f | ||
|
|
1869e6c2c3 | ||
|
|
813f7f88ad | ||
|
|
f1afa05349 | ||
|
|
7f8980b958 | ||
|
|
2907b1e148 | ||
|
|
48736d3c4d | ||
|
|
4a05f364fd | ||
|
|
adca1c5bdf | ||
|
|
6e1888b8ff |
No files matched your search
@@ -0,0 +1,22 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
# Build gate. Runs on both forges (path .github is read by Gitea and GitHub).
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run check
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Promote → GitHub
|
||||||
|
|
||||||
|
# Runs on GITEA ONLY. Mirrors only main + version tags to the public GitHub repo.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
tags: ['v*']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
push-github:
|
||||||
|
if: ${{ github.server_url != 'https://github.com' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Push main + tags to GitHub
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GH_PROMOTE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
git remote add github "https://x-access-token:${GH_TOKEN}@github.com/Expressive-Tea/green-tea-site.git"
|
||||||
|
if [ "${{ github.ref_type }}" = "tag" ]; then
|
||||||
|
git push github "refs/tags/${{ github.ref_name }}"
|
||||||
|
else
|
||||||
|
git push github "HEAD:refs/heads/main"
|
||||||
|
git push github --tags
|
||||||
|
fi
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
name: Release → dist.tar.gz
|
||||||
|
|
||||||
|
# Production artifact. Runs on GITHUB ONLY, on a version tag. Builds the static site
|
||||||
|
# and packages dist/ as a .tar.gz attached to the GitHub release — the cPanel deploy
|
||||||
|
# pulls that artifact.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ['v*']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
package:
|
||||||
|
if: ${{ github.server_url == 'https://github.com' }}
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
ARCHIVE_NAME: green-tea-site-${{ github.ref_name }}.tar.gz
|
||||||
|
RELEASE_TAG: ${{ github.ref_name }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
- name: Validate release tag
|
||||||
|
run: |
|
||||||
|
if [[ "$RELEASE_TAG" == */* ]]; then
|
||||||
|
echo "Release tag must not contain '/': $RELEASE_TAG" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run check
|
||||||
|
- name: Package dist/
|
||||||
|
run: tar -czf "$ARCHIVE_NAME" -C dist .
|
||||||
|
- name: Verify .htaccess in archive
|
||||||
|
run: tar -tzf "$ARCHIVE_NAME" | grep -Fx './.htaccess'
|
||||||
|
- name: Attach to GitHub release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: ${{ env.ARCHIVE_NAME }}
|
||||||
@@ -11,10 +11,17 @@ node_modules/
|
|||||||
.superpowers/
|
.superpowers/
|
||||||
.specs/
|
.specs/
|
||||||
|
|
||||||
|
# isolated feature worktrees
|
||||||
|
.worktrees/
|
||||||
|
|
||||||
# environment variables
|
# environment variables
|
||||||
.env
|
.env
|
||||||
.env.production
|
.env.production
|
||||||
|
|
||||||
|
# real DB credentials for the launch-list endpoint (never commit)
|
||||||
|
subscribe.config.php
|
||||||
|
**/subscribe.config.php
|
||||||
|
|
||||||
# macOS
|
# macOS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Green Tea. — marketing site
|
# Green Tea. — marketing site
|
||||||
|
|
||||||
The public marketing site for [Green Tea](https://green-tea.dev), a zen, opinionated, type-safe graph-pipeline HTTP
|
The public marketing site for [Green Tea](https://green-tea.expressive-tea.io), a zen, opinionated, type-safe graph-pipeline HTTP
|
||||||
framework. Built with [Astro](https://astro.build) — the landing page, blog, and brand shell live here. The
|
framework. Built with [Astro](https://astro.build) — the landing page, blog, and brand shell live here. The
|
||||||
framework's technical docs live in a separate repository and are only linked from this site, not rebuilt here.
|
framework's technical docs live in a separate repository and are only linked from this site, not rebuilt here.
|
||||||
|
|
||||||
@@ -50,28 +50,31 @@ public/ — static assets (favicon, og.png, robots.txt)
|
|||||||
|
|
||||||
## Deployment (manual — Cloudflare Pages)
|
## Deployment (manual — Cloudflare Pages)
|
||||||
|
|
||||||
There is no deploy CI configured for this repo. Deploys are triggered manually from the Cloudflare Pages
|
The site is hosted on the **expressive-tea.io cPanel** under the subdomain `green-tea.expressive-tea.io`.
|
||||||
dashboard:
|
There is no deploy CI — you build locally and upload the static output.
|
||||||
|
|
||||||
1. Create a new Pages project and connect this repository.
|
1. `npm run build` → static output in `dist/`.
|
||||||
2. **Framework preset:** Astro
|
2. Upload the **contents** of `dist/` into the subdomain's document root
|
||||||
3. **Build command:** `npm run build`
|
(e.g. `public_html/green-tea/`) via the cPanel File Manager or SFTP.
|
||||||
4. **Build output directory:** `dist`
|
3. The docs are a **separate build** served from `/docs` on the same subdomain — see the
|
||||||
5. Deploy, then attach the custom domain `green-tea.dev` under the project's Custom Domains settings.
|
[core repo](https://github.com/Expressive-Tea/green-tea)'s `website/` (built with `base: '/docs'`);
|
||||||
|
its `dist/` contents go into `public_html/green-tea/docs/`. Two independent builds, one subdomain,
|
||||||
|
no nested sub-subdomain.
|
||||||
|
|
||||||
Re-run the same "Create deployment" flow from the dashboard for subsequent releases — pushes do not trigger an
|
The `*.expressive-tea.io` AutoSSL certificate already covers `green-tea.expressive-tea.io`; `/docs` needs
|
||||||
automatic build.
|
no certificate of its own because it is a path, not a host.
|
||||||
|
|
||||||
## Placeholder links
|
## Links that don't resolve yet
|
||||||
|
|
||||||
The repository (`https://github.com/green-tea-dev/green-tea`) and npm package (`@green-tea/core`) referenced
|
Green Tea lives under the **Expressive-Tea** GitHub org — the same org as the framework it grew out of. The site
|
||||||
throughout the site (Header, Footer, Hero, blog) are **placeholders** — the GitHub org/repo and the npm package are
|
already points there (`https://github.com/Expressive-Tea/green-tea`, in Header, Footer, Hero, and HonestBeta), but
|
||||||
not public yet. Before launch:
|
those targets are not public yet. Before launch, confirm each one actually resolves:
|
||||||
|
|
||||||
- Confirm the real GitHub org/repo and update every reference in `src/` if it differs from
|
- The GitHub repo is public under that org.
|
||||||
`https://github.com/green-tea-dev/green-tea`.
|
- `@green-tea/core` is published to npm under that name.
|
||||||
- Confirm `@green-tea/core` is the published npm package name and update links if it changes.
|
- `https://green-tea.expressive-tea.io/docs` is live and serving the docs site.
|
||||||
- Confirm `https://docs.green-tea.dev` resolves once the docs site is live.
|
|
||||||
|
Every one of these is a visible 404 on the landing page until it's true.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,6 +6,6 @@ import sitemap from '@astrojs/sitemap';
|
|||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://green-tea.dev',
|
site: 'https://green-tea.expressive-tea.io',
|
||||||
integrations: [mdx(), sitemap()]
|
integrations: [mdx(), sitemap()]
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
# SEO and performance improvement design
|
||||||
|
|
||||||
|
Date: 2026-08-02
|
||||||
|
|
||||||
|
## Goal
|
||||||
|
|
||||||
|
Make the public site easier for search engines to understand and faster on a cold mobile load. Preserve the current visual design, static Astro architecture, and two-forge release flow.
|
||||||
|
|
||||||
|
## Baseline
|
||||||
|
|
||||||
|
Lighthouse 13 measured the deployed home page at 96 performance, 96 accessibility, 100 best practices, and 100 SEO on mobile. The desktop scores were 95, 96, 100, and 100. Mobile FCP and LCP were 2.3 seconds, TBT was 0 milliseconds, and CLS was 0.001.
|
||||||
|
|
||||||
|
The audit found five material gaps:
|
||||||
|
|
||||||
|
- Google Fonts blocks rendering and accounts for about 990 milliseconds of estimated savings.
|
||||||
|
- Hashed CSS and SVG assets have no explicit browser cache lifetime.
|
||||||
|
- HTTP serves a second working copy instead of redirecting to HTTPS.
|
||||||
|
- Pages lack product and article structured data.
|
||||||
|
- Two text treatments fail WCAG color contrast checks.
|
||||||
|
|
||||||
|
The sitemap, canonical URLs, robots file, HTTPS pages, and real 404 status already work.
|
||||||
|
|
||||||
|
## Design
|
||||||
|
|
||||||
|
### Metadata and structured data
|
||||||
|
|
||||||
|
Extend `Base.astro` with explicit page type, robots, publication metadata, and JSON-LD inputs. The home page will describe Green Tea as a software application and website. Blog posts will emit `BlogPosting` data, `og:type=article`, publication and modification dates, author, and tags. The 404 page will emit `noindex, follow`.
|
||||||
|
|
||||||
|
Keep canonical URLs derived from `Astro.site`. Serialize structured data from trusted build-time objects and render it as an `application/ld+json` script.
|
||||||
|
|
||||||
|
### Font delivery and accessibility
|
||||||
|
|
||||||
|
Remove the Google Fonts stylesheet from the page and unused Starlight brand imports from the marketing site's global CSS. Host only the WOFF2 files required for Zen Maru Gothic weights 500 and 700 under `public/fonts`, declare them with `font-display: swap`, and preload only the heading face needed above the fold.
|
||||||
|
|
||||||
|
Adjust the muted runtime caveat and syntax-comment colors until Lighthouse reports sufficient contrast. Do not change layout, spacing, copy, or component structure.
|
||||||
|
|
||||||
|
### Apache behavior
|
||||||
|
|
||||||
|
Add `public/.htaccess` so Astro copies it to `dist/.htaccess`. It will:
|
||||||
|
|
||||||
|
- redirect HTTP requests to the same HTTPS URL;
|
||||||
|
- assign a long immutable cache lifetime to hashed `/_astro/` assets;
|
||||||
|
- assign shorter cache lifetimes to fonts and static images;
|
||||||
|
- enable compression when the host provides `mod_deflate` or `mod_brotli`;
|
||||||
|
- avoid changing routes or the existing 404 behavior.
|
||||||
|
|
||||||
|
Every directive that depends on an optional Apache module will use an `IfModule` guard. The release must remain compatible with the current cPanel Apache host.
|
||||||
|
|
||||||
|
### Release boundary
|
||||||
|
|
||||||
|
GitHub remains the only forge that packages a production artifact. `.github/workflows/release.yml` already restricts its package job to `github.com` and creates `green-tea-site-<tag>.tar.gz` with `tar -C dist .`, which includes dotfiles.
|
||||||
|
|
||||||
|
Add a release validation step after the build that fails unless `dist/.htaccess` exists. Gitea will continue to run the shared build gate and promotion workflow, but it will not package or publish a release artifact.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
Run a clean production build and verify:
|
||||||
|
|
||||||
|
- `dist/.htaccess` exists and appears in a locally created tar listing;
|
||||||
|
- every indexable page has one canonical URL, description, and valid JSON-LD;
|
||||||
|
- the 404 page has `noindex, follow`;
|
||||||
|
- the sitemap lists only indexable public pages;
|
||||||
|
- no generated page requests Google Fonts;
|
||||||
|
- internal production links return expected statuses;
|
||||||
|
- Lighthouse mobile and desktop improve or hold their baseline scores;
|
||||||
|
- Lighthouse reports no automated SEO or contrast failures.
|
||||||
|
|
||||||
|
The final report will separate local build results from behavior that requires the new artifact to be deployed on Apache.
|
||||||
|
|
||||||
|
## Non-goals
|
||||||
|
|
||||||
|
This change will not redesign the site, add analytics, create keyword-stuffed copy, submit the site to Search Console, modify the documentation build under `/docs`, or create release archives in Gitea.
|
||||||
@@ -0,0 +1,366 @@
|
|||||||
|
# SEO and Performance Improvements Implementation Plan
|
||||||
|
|
||||||
|
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
||||||
|
|
||||||
|
**Goal:** Improve search-engine metadata, remove the render-blocking font dependency, fix automated contrast failures, and ship Apache redirects and caching inside the GitHub release artifact.
|
||||||
|
|
||||||
|
**Architecture:** Keep Astro's static output and extend the existing base layout with typed metadata and build-time JSON-LD. Vendor the two Latin WOFF2 font files, copy Apache configuration from `public/`, and verify generated HTML with a dependency-free Node script. Preserve the shared Gitea/GitHub build gate while keeping production packaging exclusive to GitHub.
|
||||||
|
|
||||||
|
**Tech Stack:** Astro 7, TypeScript, plain CSS, Node.js assertions, Apache `.htaccess`, GitHub Actions, Lighthouse 13.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: Add a failing generated-site verifier
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `scripts/verify-build.mjs`
|
||||||
|
- Modify: `package.json`
|
||||||
|
|
||||||
|
**Step 1: Create the verifier**
|
||||||
|
|
||||||
|
Write a Node script that reads `dist/index.html`, `dist/404.html`, the blog index, and every generated blog post. Use `node:assert/strict` to require:
|
||||||
|
|
||||||
|
- one canonical URL and one meta description per HTML page;
|
||||||
|
- parseable JSON-LD on the home page and each blog post;
|
||||||
|
- `SoftwareApplication` in the home JSON-LD graph;
|
||||||
|
- `BlogPosting`, article Open Graph metadata, dates, and author on each post;
|
||||||
|
- `noindex, follow` on the 404 page;
|
||||||
|
- no reference to `fonts.googleapis.com` or `fonts.gstatic.com`;
|
||||||
|
- a generated `dist/.htaccess` file.
|
||||||
|
|
||||||
|
The script should end with `Verified generated SEO and deploy metadata.` and exit nonzero on the first failed assertion.
|
||||||
|
|
||||||
|
**Step 2: Add build-check scripts**
|
||||||
|
|
||||||
|
Add these entries to `package.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"check": "npm run build && npm run verify:build",
|
||||||
|
"verify:build": "node scripts/verify-build.mjs"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 3: Run the verifier against the current build**
|
||||||
|
|
||||||
|
Run: `npm run build && npm run verify:build`
|
||||||
|
|
||||||
|
Expected: FAIL because the current output has no JSON-LD and no `dist/.htaccess`.
|
||||||
|
|
||||||
|
**Step 4: Commit the failing verifier**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add package.json scripts/verify-build.mjs
|
||||||
|
git commit -m "test: verify generated SEO metadata"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Task 2: Add typed global and home-page SEO metadata
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `src/layouts/Base.astro`
|
||||||
|
- Modify: `src/pages/index.astro`
|
||||||
|
|
||||||
|
**Step 1: Extend the base layout contract**
|
||||||
|
|
||||||
|
Add these optional props:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
type OpenGraphType = 'website' | 'article';
|
||||||
|
type StructuredData = Record<string, unknown>;
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
title?: string;
|
||||||
|
description?: string;
|
||||||
|
image?: string;
|
||||||
|
ogType?: OpenGraphType;
|
||||||
|
robots?: string;
|
||||||
|
publishedTime?: Date;
|
||||||
|
updatedTime?: Date;
|
||||||
|
author?: string;
|
||||||
|
tags?: string[];
|
||||||
|
structuredData?: StructuredData;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Default `ogType` to `website` and `robots` to `index, follow`. Convert the canonical and image URLs to strings before using them in metadata.
|
||||||
|
|
||||||
|
Emit:
|
||||||
|
|
||||||
|
```astro
|
||||||
|
<meta name="robots" content={robots} />
|
||||||
|
<meta property="og:type" content={ogType} />
|
||||||
|
{
|
||||||
|
ogType === 'article' && (
|
||||||
|
<>
|
||||||
|
{publishedTime && <meta property="article:published_time" content={publishedTime.toISOString()} />}
|
||||||
|
{updatedTime && <meta property="article:modified_time" content={updatedTime.toISOString()} />}
|
||||||
|
{author && <meta property="article:author" content={author} />}
|
||||||
|
{tags?.map((tag) => <meta property="article:tag" content={tag} />)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{structuredData && (
|
||||||
|
<script
|
||||||
|
type="application/ld+json"
|
||||||
|
set:html={JSON.stringify(structuredData).replace(/</g, '\\u003c')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
```
|
||||||
|
|
||||||
|
Keep the existing title, description, canonical, Open Graph image, Twitter card, RSS, favicon, and generator metadata.
|
||||||
|
|
||||||
|
**Step 2: Add home-page JSON-LD**
|
||||||
|
|
||||||
|
In `src/pages/index.astro`, construct a single `@context` object with an `@graph` containing:
|
||||||
|
|
||||||
|
- a `WebSite` node with the canonical URL, name, and page description;
|
||||||
|
- a `SoftwareApplication` node with name, description, application category, cross-platform operating system, canonical URL, repository URL, MIT license URL, and a zero-price `Offer`.
|
||||||
|
|
||||||
|
Pass that object through `structuredData` on `<Base>`.
|
||||||
|
|
||||||
|
**Step 3: Build and inspect the home page**
|
||||||
|
|
||||||
|
Run: `npm run build`
|
||||||
|
|
||||||
|
Expected: PASS. `dist/index.html` contains one canonical tag, `robots=index, follow`, and parseable JSON-LD containing `WebSite` and `SoftwareApplication`.
|
||||||
|
|
||||||
|
**Step 4: Commit global and home metadata**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add src/layouts/Base.astro src/pages/index.astro
|
||||||
|
git commit -m "feat: add structured product metadata"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Task 3: Add article metadata and exclude the 404 page
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `src/layouts/Post.astro`
|
||||||
|
- Modify: `src/pages/404.astro`
|
||||||
|
|
||||||
|
**Step 1: Construct article JSON-LD**
|
||||||
|
|
||||||
|
In `Post.astro`, derive absolute canonical and hero-image URLs from `Astro.url.pathname` and `Astro.site`. Create a `BlogPosting` object containing:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const structuredData = {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'BlogPosting',
|
||||||
|
headline: title,
|
||||||
|
description,
|
||||||
|
image: absoluteHeroImage,
|
||||||
|
datePublished: pubDate.toISOString(),
|
||||||
|
dateModified: (updatedDate ?? pubDate).toISOString(),
|
||||||
|
author: { '@type': 'Person', name: author },
|
||||||
|
publisher: { '@type': 'Organization', name: 'Expressive Tea Team' },
|
||||||
|
mainEntityOfPage: canonicalURL,
|
||||||
|
keywords: tags?.join(', '),
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Pass `ogType="article"`, dates, author, tags, and `structuredData` to `Base`.
|
||||||
|
|
||||||
|
**Step 2: Mark the 404 page for exclusion**
|
||||||
|
|
||||||
|
Pass `robots="noindex, follow"` to `Base` in `src/pages/404.astro`.
|
||||||
|
|
||||||
|
**Step 3: Build and inspect posts and 404 output**
|
||||||
|
|
||||||
|
Run: `npm run build`
|
||||||
|
|
||||||
|
Expected: PASS. Each post contains article metadata and parseable `BlogPosting` JSON-LD. `dist/404.html` contains `noindex, follow` and no indexable structured-data entity.
|
||||||
|
|
||||||
|
**Step 4: Commit article and 404 metadata**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add src/layouts/Post.astro src/pages/404.astro
|
||||||
|
git commit -m "feat: describe blog posts to search engines"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Task 4: Self-host the heading font and fix contrast
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `public/fonts/zen-maru-gothic-latin-500.woff2`
|
||||||
|
- Create: `public/fonts/zen-maru-gothic-latin-700.woff2`
|
||||||
|
- Create: `public/fonts/OFL.txt`
|
||||||
|
- Modify: `src/layouts/Base.astro`
|
||||||
|
- Modify: `src/styles/global.css`
|
||||||
|
- Modify: `src/components/sections/RunsEverywhere.astro`
|
||||||
|
- Modify: `src/components/sections/SeeIt.astro`
|
||||||
|
|
||||||
|
**Step 1: Vendor the exact Latin font files**
|
||||||
|
|
||||||
|
Download the Google Fonts v19 Latin WOFF2 assets and the Zen Maru Gothic OFL license. Record and verify these SHA-256 hashes:
|
||||||
|
|
||||||
|
```text
|
||||||
|
2c5953da616e5e6dcad34ae8b744f7e759f1647c041389681fa2360908508d55 zen-maru-gothic-latin-500.woff2
|
||||||
|
9d65f92a3e11edcef9d73694b5b73cb6888243aee54e8034b162eb368c6ff3ed zen-maru-gothic-latin-700.woff2
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 2: Declare local font faces**
|
||||||
|
|
||||||
|
Remove `@import './brand.css';` from `src/styles/global.css`. Add two `@font-face` rules using the local files, `font-style: normal`, weights 500 and 700, `font-display: swap`, and the Latin unicode range supplied by Google Fonts.
|
||||||
|
|
||||||
|
The detached `src/styles/brand.css` belongs to the separate Starlight docs theme and must not load in this marketing build.
|
||||||
|
|
||||||
|
**Step 3: Remove the external font connection**
|
||||||
|
|
||||||
|
Delete the Google Fonts preconnect and stylesheet tags from `Base.astro`. Add one preload:
|
||||||
|
|
||||||
|
```astro
|
||||||
|
<link
|
||||||
|
rel="preload"
|
||||||
|
href="/fonts/zen-maru-gothic-latin-700.woff2"
|
||||||
|
as="font"
|
||||||
|
type="font/woff2"
|
||||||
|
crossorigin
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 4: Fix both Lighthouse contrast findings**
|
||||||
|
|
||||||
|
Remove `opacity: 0.75` from `.runs__caveat` so it inherits the accessible `--dim` color at full opacity. Change the Astro `Code` theme in `SeeIt.astro` from `github-dark` to `github-dark-high-contrast`.
|
||||||
|
|
||||||
|
**Step 5: Build and check output dependencies**
|
||||||
|
|
||||||
|
Run: `npm run build && ! rg 'fonts\\.(googleapis|gstatic)\\.com' dist`
|
||||||
|
|
||||||
|
Expected: PASS. The font files exist under `dist/fonts`, and no generated page references Google-hosted fonts.
|
||||||
|
|
||||||
|
**Step 6: Commit font and contrast changes**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add public/fonts src/layouts/Base.astro src/styles/global.css \
|
||||||
|
src/components/sections/RunsEverywhere.astro src/components/sections/SeeIt.astro
|
||||||
|
git commit -m "perf: self-host heading fonts"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Task 5: Ship Apache behavior in the static build
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `public/.htaccess`
|
||||||
|
|
||||||
|
**Step 1: Add the canonical HTTPS redirect**
|
||||||
|
|
||||||
|
Use `mod_rewrite` under `IfModule`. When `%{HTTPS}` is not `on`, redirect with status 301 to `https://green-tea.expressive-tea.io%{REQUEST_URI}`. Use `NE` and `L` flags.
|
||||||
|
|
||||||
|
**Step 2: Add guarded caching and compression**
|
||||||
|
|
||||||
|
Under guarded `mod_expires` and `mod_headers` blocks:
|
||||||
|
|
||||||
|
- cache fingerprinted CSS, JavaScript, SVG, and image assets for one year with `immutable`;
|
||||||
|
- cache WOFF2 files for one year;
|
||||||
|
- cache ordinary images and icons for seven days;
|
||||||
|
- mark HTML as immediately stale with `public, max-age=0, must-revalidate`.
|
||||||
|
|
||||||
|
Use `mod_deflate` for HTML, CSS, JavaScript, JSON, XML, SVG, and plain text. Do not add rewrites for Astro routes.
|
||||||
|
|
||||||
|
**Step 3: Verify Astro copies the dotfile**
|
||||||
|
|
||||||
|
Run: `npm run check`
|
||||||
|
|
||||||
|
Expected: PASS and print `Verified generated SEO and deploy metadata.` Confirm `test -f dist/.htaccess` exits zero.
|
||||||
|
|
||||||
|
**Step 4: Commit Apache configuration**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add public/.htaccess
|
||||||
|
git commit -m "perf: ship Apache caching and HTTPS redirect"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Task 6: Keep packaging exclusive to GitHub and enforce the artifact contract
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `.github/workflows/ci.yml`
|
||||||
|
- Modify: `.github/workflows/release.yml`
|
||||||
|
|
||||||
|
**Step 1: Run generated-output checks in the shared build gate**
|
||||||
|
|
||||||
|
Replace `npm run build` with `npm run check` in `ci.yml`. This check may run on GitHub and Gitea; it creates no release artifact.
|
||||||
|
|
||||||
|
**Step 2: Verify the release archive in the GitHub-only job**
|
||||||
|
|
||||||
|
Keep the existing job condition:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
if: ${{ github.server_url == 'https://github.com' }}
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace the release build command with `npm run check`. After packaging, add:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Verify package contents
|
||||||
|
run: tar -tzf "green-tea-site-${{ github.ref_name }}.tar.gz" | grep -Fx './.htaccess'
|
||||||
|
```
|
||||||
|
|
||||||
|
Do not change `.github/workflows/promote.yml` and do not add a Gitea artifact job.
|
||||||
|
|
||||||
|
**Step 3: Inspect the workflow diff**
|
||||||
|
|
||||||
|
Run: `git diff --check && git diff -- .github/workflows/ci.yml .github/workflows/release.yml`
|
||||||
|
|
||||||
|
Expected: both workflows use `npm run check`; only `release.yml` contains `tar`, `softprops/action-gh-release`, and the `github.com` job guard.
|
||||||
|
|
||||||
|
**Step 4: Commit workflow verification**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add .github/workflows/ci.yml .github/workflows/release.yml
|
||||||
|
git commit -m "ci: verify the GitHub release artifact"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Task 7: Run final build and Lighthouse verification
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify if needed: files changed in Tasks 1-6
|
||||||
|
|
||||||
|
**Step 1: Run repository checks**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run check
|
||||||
|
git diff --check
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected: both commands pass.
|
||||||
|
|
||||||
|
**Step 2: Reproduce the GitHub archive locally**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tar -czf /tmp/green-tea-site-seo-audit.tar.gz -C dist .
|
||||||
|
tar -tzf /tmp/green-tea-site-seo-audit.tar.gz | grep -Fx './.htaccess'
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected: `./.htaccess`.
|
||||||
|
|
||||||
|
**Step 3: Serve the production build**
|
||||||
|
|
||||||
|
Run: `npm run preview -- --host 127.0.0.1`
|
||||||
|
|
||||||
|
Keep the preview process running for the next two steps.
|
||||||
|
|
||||||
|
**Step 4: Run mobile Lighthouse**
|
||||||
|
|
||||||
|
Run Lighthouse 13 against `http://127.0.0.1:4321/` with mobile simulated throttling and JSON output.
|
||||||
|
|
||||||
|
Expected: 100 SEO, 100 best practices, no color-contrast failure, no Google Fonts request, TBT of 0 milliseconds, and performance at or above the deployed baseline of 96 when measured under equivalent settings.
|
||||||
|
|
||||||
|
**Step 5: Run desktop Lighthouse**
|
||||||
|
|
||||||
|
Run Lighthouse 13 with the desktop preset.
|
||||||
|
|
||||||
|
Expected: 100 SEO, 100 best practices, no color-contrast failure, and performance at or above the deployed baseline of 95 when measured under equivalent settings.
|
||||||
|
|
||||||
|
**Step 6: Inspect generated metadata and Git state**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rg -n 'application/ld\\+json|article:published_time|noindex, follow' dist/index.html dist/blog dist/404.html
|
||||||
|
git status --short --branch
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected: all metadata is present and only intentional changes remain.
|
||||||
|
|
||||||
|
**Step 7: Commit any verification-driven correction**
|
||||||
|
|
||||||
|
If Lighthouse required a correction, stage only that correction and commit it with a focused message. Do not create an empty verification commit.
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "green-tea-site",
|
"name": "green-tea-site",
|
||||||
"version": "0.0.1",
|
"version": "26.8.0-beta.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "green-tea-site",
|
"name": "green-tea-site",
|
||||||
"version": "0.0.1",
|
"version": "26.8.0-beta.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^7.0.2",
|
"@astrojs/mdx": "^7.0.2",
|
||||||
"@astrojs/rss": "^4.0.19",
|
"@astrojs/rss": "^4.0.19",
|
||||||
|
|||||||
+3
-1
@@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "green-tea-site",
|
"name": "green-tea-site",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.1",
|
"version": "26.8.0-beta.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=22.12.0"
|
"node": ">=22.12.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"dev": "astro dev",
|
||||||
"build": "astro build",
|
"build": "astro build",
|
||||||
|
"check": "npm run build && npm run verify:build",
|
||||||
|
"verify:build": "node scripts/verify-build.mjs",
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{HTTPS} !=on
|
||||||
|
RewriteRule ^ https://green-tea.expressive-tea.io%{REQUEST_URI} [R=301,L]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_expires.c>
|
||||||
|
ExpiresActive On
|
||||||
|
ExpiresByType text/html "access plus 0 seconds"
|
||||||
|
ExpiresByType text/css "access plus 7 days"
|
||||||
|
ExpiresByType text/javascript "access plus 7 days"
|
||||||
|
ExpiresByType application/javascript "access plus 7 days"
|
||||||
|
ExpiresByType font/woff2 "access plus 1 year"
|
||||||
|
ExpiresByType image/avif "access plus 7 days"
|
||||||
|
ExpiresByType image/gif "access plus 7 days"
|
||||||
|
ExpiresByType image/jpeg "access plus 7 days"
|
||||||
|
ExpiresByType image/png "access plus 7 days"
|
||||||
|
ExpiresByType image/svg+xml "access plus 7 days"
|
||||||
|
ExpiresByType image/webp "access plus 7 days"
|
||||||
|
ExpiresByType image/x-icon "access plus 7 days"
|
||||||
|
|
||||||
|
<FilesMatch "\.[A-Za-z0-9_-]{8,}\.(?:avif|css|eot|gif|ico|jpe?g|js|mjs|otf|png|svg|ttf|webp|woff2?)$">
|
||||||
|
ExpiresActive Off
|
||||||
|
</FilesMatch>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
<FilesMatch "\.html?$">
|
||||||
|
Header set Cache-Control "public, max-age=0, must-revalidate"
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
<FilesMatch "\.woff2$">
|
||||||
|
Header set Cache-Control "public, max-age=31536000"
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
<FilesMatch "\.(?:avif|gif|ico|jpe?g|png|svg|webp)$">
|
||||||
|
Header set Cache-Control "public, max-age=604800"
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
<FilesMatch "\.[A-Za-z0-9_-]{8,}\.(?:avif|css|eot|gif|ico|jpe?g|js|mjs|otf|png|svg|ttf|webp|woff2?)$">
|
||||||
|
Header set Cache-Control "public, max-age=31536000, immutable"
|
||||||
|
</FilesMatch>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_deflate.c>
|
||||||
|
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript text/xml
|
||||||
|
AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/json application/ld+json
|
||||||
|
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/atom+xml image/svg+xml
|
||||||
|
</IfModule>
|
||||||
@@ -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.
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
User-agent: *
|
User-agent: *
|
||||||
Allow: /
|
Allow: /
|
||||||
|
|
||||||
Sitemap: https://green-tea.dev/sitemap-index.xml
|
Sitemap: https://green-tea.expressive-tea.io/sitemap-index.xml
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Green Tea launch-list capture.
|
||||||
|
*
|
||||||
|
* The static site POSTs here (same origin on the cPanel subdomain). A valid
|
||||||
|
* email lands in MySQL; duplicates are a silent no-op. DB credentials live in
|
||||||
|
* subscribe.config.php, kept OUTSIDE the web root — see server/ in the repo.
|
||||||
|
*/
|
||||||
|
|
||||||
|
header('X-Content-Type-Options: nosniff');
|
||||||
|
|
||||||
|
/** Reply as JSON to fetch(), redirect back for a no-JS form post. */
|
||||||
|
function respond(bool $ok, int $code, string $message, bool $wantsJson): void
|
||||||
|
{
|
||||||
|
http_response_code($code);
|
||||||
|
if ($wantsJson) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(['ok' => $ok, 'message' => $message]);
|
||||||
|
} else {
|
||||||
|
header('Location: /?subscribed=' . ($ok ? '1' : '0') . '#subscribe');
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$wantsJson = isset($_SERVER['HTTP_X_REQUESTED_WITH'])
|
||||||
|
&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'fetch';
|
||||||
|
|
||||||
|
if (($_SERVER['REQUEST_METHOD'] ?? 'GET') !== 'POST') {
|
||||||
|
respond(false, 405, 'Method not allowed.', $wantsJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Honeypot: bots fill hidden fields, people don't. Accept silently, store nothing.
|
||||||
|
if (trim((string) ($_POST['website'] ?? '')) !== '') {
|
||||||
|
respond(true, 200, "You're on the list.", $wantsJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
$email = trim((string) ($_POST['email'] ?? ''));
|
||||||
|
if ($email === '' || strlen($email) > 254 || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
respond(false, 422, 'Please enter a valid email address.', $wantsJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Config one level above the web root is preferred; same-dir is a fallback.
|
||||||
|
$configFile = __DIR__ . '/../subscribe.config.php';
|
||||||
|
if (!is_file($configFile)) {
|
||||||
|
$configFile = __DIR__ . '/subscribe.config.php';
|
||||||
|
}
|
||||||
|
if (!is_file($configFile)) {
|
||||||
|
error_log('subscribe: missing subscribe.config.php');
|
||||||
|
respond(false, 500, 'Signups are not configured yet.', $wantsJson);
|
||||||
|
}
|
||||||
|
$config = require $configFile;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = new PDO($config['dsn'], $config['user'], $config['pass'], [
|
||||||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
|
]);
|
||||||
|
// Unique index on email makes this idempotent — a repeat signup is a no-op.
|
||||||
|
$stmt = $pdo->prepare(
|
||||||
|
'INSERT INTO subscribers (email, created_at, ip) VALUES (:email, NOW(), :ip)
|
||||||
|
ON DUPLICATE KEY UPDATE email = email'
|
||||||
|
);
|
||||||
|
$stmt->execute([
|
||||||
|
':email' => $email,
|
||||||
|
':ip' => $_SERVER['REMOTE_ADDR'] ?? null,
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
error_log('subscribe: ' . $e->getMessage());
|
||||||
|
respond(false, 500, 'Could not save that right now — try again later.', $wantsJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional heads-up email. Never fatal: the DB row is the source of truth.
|
||||||
|
if (!empty($config['notify'])) {
|
||||||
|
@mail(
|
||||||
|
(string) $config['notify'],
|
||||||
|
'Green Tea: new subscriber',
|
||||||
|
"New launch-list signup: {$email}",
|
||||||
|
'From: Green Tea <' . $config['notify'] . '>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
respond(true, 200, "You're on the list — we'll ping you at 1.0.", $wantsJson);
|
||||||
@@ -0,0 +1,408 @@
|
|||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
||||||
|
import { join, relative, resolve } from 'node:path';
|
||||||
|
|
||||||
|
const distDir = resolve('dist');
|
||||||
|
const productionOrigin = 'https://green-tea.expressive-tea.io';
|
||||||
|
const homeCanonical = `${productionOrigin}/`;
|
||||||
|
|
||||||
|
function readHtml(filePath) {
|
||||||
|
assert.ok(existsSync(filePath), `Missing generated HTML: ${relative(distDir, filePath)}`);
|
||||||
|
return readFileSync(filePath, 'utf8');
|
||||||
|
}
|
||||||
|
|
||||||
|
function tags(html, tagName) {
|
||||||
|
return html.match(new RegExp(`<${tagName}\\b[^>]*>`, 'gi')) ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function attribute(tag, name) {
|
||||||
|
const match = tag.match(
|
||||||
|
new RegExp(`\\s${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, 'i'),
|
||||||
|
);
|
||||||
|
return match?.[1] ?? match?.[2] ?? match?.[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
function metaTags(html, attributeName, attributeValue) {
|
||||||
|
return tags(html, 'meta').filter(
|
||||||
|
(tag) => attribute(tag, attributeName)?.toLowerCase() === attributeValue.toLowerCase(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function metaDescription(html, label) {
|
||||||
|
const descriptions = metaTags(html, 'name', 'description');
|
||||||
|
assert.equal(descriptions.length, 1, `${label} must have exactly one meta description`);
|
||||||
|
const description = attribute(descriptions[0], 'content')?.trim();
|
||||||
|
assert.ok(description, `${label} meta description must not be empty`);
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
function expectedCanonicalFor(label) {
|
||||||
|
const generatedPath = label.replaceAll('\\', '/');
|
||||||
|
if (generatedPath === 'index.html') return homeCanonical;
|
||||||
|
if (generatedPath === '404.html') return `${productionOrigin}/404/`;
|
||||||
|
assert.ok(
|
||||||
|
generatedPath.endsWith('/index.html'),
|
||||||
|
`Cannot derive a canonical route from generated page ${generatedPath}`,
|
||||||
|
);
|
||||||
|
return `${productionOrigin}/${generatedPath.slice(0, -'index.html'.length)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function requireAbsoluteHttps(value, message) {
|
||||||
|
let parsedUrl;
|
||||||
|
assert.doesNotThrow(
|
||||||
|
() => {
|
||||||
|
parsedUrl = new URL(value);
|
||||||
|
},
|
||||||
|
`${message} must be a valid absolute URL`,
|
||||||
|
);
|
||||||
|
assert.equal(parsedUrl.protocol, 'https:', `${message} must use HTTPS`);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyPageMetadata({ label, generatedPath = label, html, isPost = false }) {
|
||||||
|
const expectedCanonical = expectedCanonicalFor(generatedPath);
|
||||||
|
const canonicals = tags(html, 'link').filter((tag) =>
|
||||||
|
attribute(tag, 'rel')
|
||||||
|
?.toLowerCase()
|
||||||
|
.split(/\s+/)
|
||||||
|
.includes('canonical'),
|
||||||
|
);
|
||||||
|
assert.equal(canonicals.length, 1, `${label} must have exactly one canonical URL`);
|
||||||
|
const canonicalUrl = attribute(canonicals[0], 'href');
|
||||||
|
assert.equal(
|
||||||
|
canonicalUrl,
|
||||||
|
expectedCanonical,
|
||||||
|
`${label} canonical URL must match its generated route`,
|
||||||
|
);
|
||||||
|
requireAbsoluteHttps(canonicalUrl, `${label} canonical URL`);
|
||||||
|
|
||||||
|
const description = metaDescription(html, label);
|
||||||
|
const robots = metaTags(html, 'name', 'robots');
|
||||||
|
assert.equal(robots.length, 1, `${label} must have exactly one robots meta tag`);
|
||||||
|
assert.equal(
|
||||||
|
attribute(robots[0], 'content')?.toLowerCase(),
|
||||||
|
generatedPath === '404.html' ? 'noindex, follow' : 'index, follow',
|
||||||
|
`${label} robots metadata has an unexpected value`,
|
||||||
|
);
|
||||||
|
|
||||||
|
requireSingleMeta(html, label, 'og:type', isPost ? 'article' : 'website');
|
||||||
|
const ogUrl = attribute(requireSingleMeta(html, label, 'og:url'), 'content');
|
||||||
|
assert.equal(ogUrl, canonicalUrl, `${label} og:url must match its canonical URL`);
|
||||||
|
assert.ok(
|
||||||
|
attribute(requireSingleMeta(html, label, 'og:title'), 'content')?.trim(),
|
||||||
|
`${label} og:title must not be blank`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
attribute(requireSingleMeta(html, label, 'og:description'), 'content'),
|
||||||
|
description,
|
||||||
|
`${label} og:description must match its meta description`,
|
||||||
|
);
|
||||||
|
const ogImage = attribute(requireSingleMeta(html, label, 'og:image'), 'content');
|
||||||
|
requireAbsoluteHttps(ogImage, `${label} og:image`);
|
||||||
|
|
||||||
|
return { canonicalUrl, description, ogImage };
|
||||||
|
}
|
||||||
|
|
||||||
|
function findGeneratedTextAssets(directory) {
|
||||||
|
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
||||||
|
const entryPath = join(directory, entry.name);
|
||||||
|
if (entry.isDirectory()) return findGeneratedTextAssets(entryPath);
|
||||||
|
return entry.isFile() && /\.(?:html|css|js|mjs|svg|xml|json)$/i.test(entry.name)
|
||||||
|
? [entryPath]
|
||||||
|
: [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseJsonLd(html, label) {
|
||||||
|
const scripts = [];
|
||||||
|
const scriptPattern = /<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi;
|
||||||
|
let match;
|
||||||
|
|
||||||
|
while ((match = scriptPattern.exec(html)) !== null) {
|
||||||
|
if (attribute(`<script${match[1]}>`, 'type')?.toLowerCase() === 'application/ld+json') {
|
||||||
|
scripts.push(match[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.ok(scripts.length > 0, `${label} must have parseable JSON-LD`);
|
||||||
|
|
||||||
|
return scripts.map((source, index) => {
|
||||||
|
try {
|
||||||
|
return JSON.parse(source);
|
||||||
|
} catch (error) {
|
||||||
|
assert.fail(`${label} JSON-LD script ${index + 1} is invalid: ${error.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function findNodesByType(value, expectedType, matches = []) {
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
for (const item of value) findNodesByType(item, expectedType, matches);
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
if (value === null || typeof value !== 'object') return matches;
|
||||||
|
|
||||||
|
const types = Array.isArray(value['@type']) ? value['@type'] : [value['@type']];
|
||||||
|
if (types.includes(expectedType)) matches.push(value);
|
||||||
|
for (const item of Object.values(value)) findNodesByType(item, expectedType, matches);
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
function requireValidDate(value, message) {
|
||||||
|
assert.equal(typeof value, 'string', `${message} must be a string`);
|
||||||
|
assert.match(
|
||||||
|
value,
|
||||||
|
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/,
|
||||||
|
`${message} must use ISO-8601 UTC format`,
|
||||||
|
);
|
||||||
|
const parsedDate = new Date(value);
|
||||||
|
assert.ok(!Number.isNaN(parsedDate.valueOf()), `${message} must be a valid date`);
|
||||||
|
assert.equal(parsedDate.toISOString(), value, `${message} must not normalize an impossible date`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function requireSingleMeta(html, label, property, expectedContent) {
|
||||||
|
const matching = metaTags(html, 'property', property);
|
||||||
|
assert.equal(matching.length, 1, `${label} must have exactly one ${property} meta tag`);
|
||||||
|
if (expectedContent !== undefined) {
|
||||||
|
assert.equal(
|
||||||
|
attribute(matching[0], 'content')?.toLowerCase(),
|
||||||
|
expectedContent.toLowerCase(),
|
||||||
|
`${label} ${property} must be ${expectedContent}`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
assert.ok(attribute(matching[0], 'content')?.trim(), `${label} ${property} must not be empty`);
|
||||||
|
}
|
||||||
|
return matching[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.ok(existsSync(distDir), 'Missing generated dist directory');
|
||||||
|
const generatedTextAssets = findGeneratedTextAssets(distDir);
|
||||||
|
const htmlPages = generatedTextAssets
|
||||||
|
.filter((filePath) => filePath.toLowerCase().endsWith('.html'))
|
||||||
|
.map((filePath) => ({
|
||||||
|
label: relative(distDir, filePath),
|
||||||
|
path: filePath,
|
||||||
|
html: readHtml(filePath),
|
||||||
|
}));
|
||||||
|
assert.ok(htmlPages.length > 0, 'Expected at least one generated HTML page');
|
||||||
|
|
||||||
|
function requirePage(relativePath, label) {
|
||||||
|
const page = htmlPages.find((candidate) => candidate.label === relativePath);
|
||||||
|
assert.ok(page, `Missing generated ${label}: ${relativePath}`);
|
||||||
|
return { ...page, generatedPath: relativePath, label };
|
||||||
|
}
|
||||||
|
|
||||||
|
const home = requirePage('index.html', 'home page');
|
||||||
|
const notFound = requirePage('404.html', '404 page');
|
||||||
|
requirePage(join('blog', 'index.html'), 'blog index');
|
||||||
|
|
||||||
|
const postPages = htmlPages
|
||||||
|
.map((page) => ({ ...page, route: page.label.replaceAll('\\', '/') }))
|
||||||
|
.filter(
|
||||||
|
(page) =>
|
||||||
|
page.route.startsWith('blog/') &&
|
||||||
|
page.route.endsWith('/index.html') &&
|
||||||
|
page.route !== 'blog/index.html',
|
||||||
|
)
|
||||||
|
.map((page) => ({
|
||||||
|
...page,
|
||||||
|
generatedPath: page.route,
|
||||||
|
label: `blog post ${page.route.slice('blog/'.length, -'/index.html'.length)}`,
|
||||||
|
}));
|
||||||
|
assert.ok(postPages.length > 0, 'Expected at least one generated blog post');
|
||||||
|
|
||||||
|
const homeJsonLd = parseJsonLd(home.html, home.label);
|
||||||
|
assert.equal(homeJsonLd.length, 1, 'home page must have exactly one JSON-LD script');
|
||||||
|
const homeMetadata = verifyPageMetadata(home);
|
||||||
|
const websites = findNodesByType(homeJsonLd, 'WebSite');
|
||||||
|
assert.equal(websites.length, 1, 'home page JSON-LD must contain exactly one WebSite');
|
||||||
|
const [website] = websites;
|
||||||
|
assert.equal(website.name, 'Green Tea', 'home page WebSite name must be Green Tea');
|
||||||
|
assert.equal(
|
||||||
|
website.description,
|
||||||
|
homeMetadata.description,
|
||||||
|
'home page WebSite description must match the meta description',
|
||||||
|
);
|
||||||
|
assert.equal(website.url, homeCanonical, 'home page WebSite URL must be canonical');
|
||||||
|
requireAbsoluteHttps(website.url, 'home page WebSite URL');
|
||||||
|
|
||||||
|
const softwareApplications = findNodesByType(homeJsonLd, 'SoftwareApplication');
|
||||||
|
assert.equal(
|
||||||
|
softwareApplications.length,
|
||||||
|
1,
|
||||||
|
'home page JSON-LD must contain exactly one SoftwareApplication',
|
||||||
|
);
|
||||||
|
const [softwareApplication] = softwareApplications;
|
||||||
|
assert.equal(softwareApplication.name, 'Green Tea', 'SoftwareApplication name must be Green Tea');
|
||||||
|
assert.equal(
|
||||||
|
softwareApplication.description,
|
||||||
|
homeMetadata.description,
|
||||||
|
'SoftwareApplication description must match the meta description',
|
||||||
|
);
|
||||||
|
assert.equal(softwareApplication.url, homeCanonical, 'SoftwareApplication URL must be canonical');
|
||||||
|
requireAbsoluteHttps(softwareApplication.url, 'SoftwareApplication URL');
|
||||||
|
assert.equal(
|
||||||
|
softwareApplication.applicationCategory,
|
||||||
|
'DeveloperApplication',
|
||||||
|
'SoftwareApplication category must be DeveloperApplication',
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
softwareApplication.operatingSystem,
|
||||||
|
'Cross-platform',
|
||||||
|
'SoftwareApplication operating system must be cross-platform',
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
softwareApplication.sameAs,
|
||||||
|
'https://github.com/Expressive-Tea/green-tea',
|
||||||
|
'SoftwareApplication sameAs must reference the GitHub repository',
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
softwareApplication.license,
|
||||||
|
'https://github.com/Expressive-Tea/green-tea/blob/main/LICENSE',
|
||||||
|
'SoftwareApplication license must reference the MIT license',
|
||||||
|
);
|
||||||
|
requireAbsoluteHttps(softwareApplication.license, 'SoftwareApplication license URL');
|
||||||
|
assert.equal(typeof softwareApplication.offers, 'object', 'SoftwareApplication must have an Offer');
|
||||||
|
assert.ok(
|
||||||
|
!Array.isArray(softwareApplication.offers) && softwareApplication.offers !== null,
|
||||||
|
'SoftwareApplication Offer must be an object',
|
||||||
|
);
|
||||||
|
assert.equal(softwareApplication.offers['@type'], 'Offer', 'SoftwareApplication offer type must be Offer');
|
||||||
|
assert.equal(softwareApplication.offers.price, '0', 'SoftwareApplication offer price must be zero');
|
||||||
|
assert.equal(
|
||||||
|
softwareApplication.offers.priceCurrency,
|
||||||
|
'USD',
|
||||||
|
'SoftwareApplication offer currency must be USD',
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const page of htmlPages) {
|
||||||
|
if (page.path === home.path || postPages.some((post) => post.path === page.path)) continue;
|
||||||
|
verifyPageMetadata(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const post of postPages) {
|
||||||
|
const postMetadata = verifyPageMetadata({ ...post, isPost: true });
|
||||||
|
const jsonLd = parseJsonLd(post.html, post.label);
|
||||||
|
const blogPostings = findNodesByType(jsonLd, 'BlogPosting');
|
||||||
|
assert.equal(blogPostings.length, 1, `${post.label} JSON-LD must contain one BlogPosting`);
|
||||||
|
const [blogPosting] = blogPostings;
|
||||||
|
assert.ok(
|
||||||
|
typeof blogPosting.headline === 'string' && blogPosting.headline.trim(),
|
||||||
|
`${post.label} BlogPosting headline must not be empty`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
blogPosting.description,
|
||||||
|
postMetadata.description,
|
||||||
|
`${post.label} BlogPosting description must match the meta description`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
blogPosting.image,
|
||||||
|
postMetadata.ogImage,
|
||||||
|
`${post.label} BlogPosting image must match og:image`,
|
||||||
|
);
|
||||||
|
requireAbsoluteHttps(blogPosting.image, `${post.label} BlogPosting image`);
|
||||||
|
assert.equal(
|
||||||
|
blogPosting.mainEntityOfPage,
|
||||||
|
postMetadata.canonicalUrl,
|
||||||
|
`${post.label} BlogPosting mainEntityOfPage must match the canonical URL`,
|
||||||
|
);
|
||||||
|
requireValidDate(blogPosting.datePublished, `${post.label} BlogPosting datePublished`);
|
||||||
|
requireValidDate(blogPosting.dateModified, `${post.label} BlogPosting dateModified`);
|
||||||
|
assert.equal(typeof blogPosting.author, 'object', `${post.label} BlogPosting author must be an object`);
|
||||||
|
assert.ok(
|
||||||
|
!Array.isArray(blogPosting.author) && blogPosting.author !== null,
|
||||||
|
`${post.label} BlogPosting author must be an object`,
|
||||||
|
);
|
||||||
|
assert.equal(blogPosting.author['@type'], 'Person', `${post.label} BlogPosting author must be a Person`);
|
||||||
|
assert.ok(
|
||||||
|
typeof blogPosting.author.name === 'string' && blogPosting.author.name.trim(),
|
||||||
|
`${post.label} BlogPosting author.name must not be empty`,
|
||||||
|
);
|
||||||
|
assert.equal(typeof blogPosting.publisher, 'object', `${post.label} publisher must be an object`);
|
||||||
|
assert.ok(
|
||||||
|
!Array.isArray(blogPosting.publisher) && blogPosting.publisher !== null,
|
||||||
|
`${post.label} publisher must be an object`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
blogPosting.publisher['@type'],
|
||||||
|
'Organization',
|
||||||
|
`${post.label} publisher must be an Organization`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
blogPosting.publisher.name,
|
||||||
|
'Expressive Tea Team',
|
||||||
|
`${post.label} publisher must be Expressive Tea Team`,
|
||||||
|
);
|
||||||
|
const publishedTime = requireSingleMeta(post.html, post.label, 'article:published_time');
|
||||||
|
const modifiedTime = requireSingleMeta(post.html, post.label, 'article:modified_time');
|
||||||
|
const articleAuthors = metaTags(post.html, 'property', 'article:author');
|
||||||
|
for (const articleAuthor of articleAuthors) {
|
||||||
|
const authorUrl = attribute(articleAuthor, 'content');
|
||||||
|
assert.ok(authorUrl?.trim(), `${post.label} article:author must not be empty`);
|
||||||
|
let parsedAuthorUrl;
|
||||||
|
assert.doesNotThrow(
|
||||||
|
() => {
|
||||||
|
parsedAuthorUrl = new URL(authorUrl);
|
||||||
|
},
|
||||||
|
`${post.label} article:author must be a valid absolute URL`,
|
||||||
|
);
|
||||||
|
assert.ok(
|
||||||
|
['https:', 'http:'].includes(parsedAuthorUrl.protocol),
|
||||||
|
`${post.label} article:author must use HTTP or HTTPS`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const publishedTimeContent = attribute(publishedTime, 'content');
|
||||||
|
const modifiedTimeContent = attribute(modifiedTime, 'content');
|
||||||
|
requireValidDate(publishedTimeContent, `${post.label} article:published_time content`);
|
||||||
|
requireValidDate(modifiedTimeContent, `${post.label} article:modified_time content`);
|
||||||
|
assert.equal(
|
||||||
|
publishedTimeContent,
|
||||||
|
blogPosting.datePublished,
|
||||||
|
`${post.label} article:published_time must match BlogPosting datePublished`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
modifiedTimeContent,
|
||||||
|
blogPosting.dateModified,
|
||||||
|
`${post.label} article:modified_time must match BlogPosting dateModified`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const articleTags = metaTags(post.html, 'property', 'article:tag').map((tag) =>
|
||||||
|
attribute(tag, 'content')?.trim(),
|
||||||
|
);
|
||||||
|
assert.ok(articleTags.every(Boolean), `${post.label} article:tag values must not be empty`);
|
||||||
|
assert.equal(
|
||||||
|
new Set(articleTags).size,
|
||||||
|
articleTags.length,
|
||||||
|
`${post.label} article:tag values must not contain duplicates`,
|
||||||
|
);
|
||||||
|
const keywordTags =
|
||||||
|
typeof blogPosting.keywords === 'string'
|
||||||
|
? blogPosting.keywords.split(',').map((keyword) => keyword.trim())
|
||||||
|
: [];
|
||||||
|
assert.ok(keywordTags.every(Boolean), `${post.label} BlogPosting keywords must not be empty`);
|
||||||
|
assert.equal(
|
||||||
|
new Set(keywordTags).size,
|
||||||
|
keywordTags.length,
|
||||||
|
`${post.label} BlogPosting keywords must not contain duplicates`,
|
||||||
|
);
|
||||||
|
assert.deepEqual(
|
||||||
|
keywordTags,
|
||||||
|
articleTags,
|
||||||
|
`${post.label} BlogPosting keywords must match article:tag metadata`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const assetPath of generatedTextAssets) {
|
||||||
|
const source = readFileSync(assetPath, 'utf8');
|
||||||
|
for (const forbiddenHost of ['fonts.googleapis.com', 'fonts.gstatic.com']) {
|
||||||
|
assert.ok(
|
||||||
|
!source.toLowerCase().includes(forbiddenHost),
|
||||||
|
`${relative(distDir, assetPath)} must not reference ${forbiddenHost}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.ok(existsSync(join(distDir, '.htaccess')), 'Missing generated dist/.htaccess');
|
||||||
|
assert.ok(statSync(join(distDir, '.htaccess')).isFile(), 'Generated dist/.htaccess must be a file');
|
||||||
|
|
||||||
|
console.log('Verified generated SEO and deploy metadata.');
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Launch-list backend (cPanel)
|
||||||
|
|
||||||
|
The email capture on the site posts to `subscribe.php`, which ships in the build
|
||||||
|
(`public/subscribe.php` → `dist/subscribe.php`). To wire it up on cPanel:
|
||||||
|
|
||||||
|
1. **Create the DB** in cPanel → MySQL Databases. Note db name, user, password.
|
||||||
|
2. **Create the table**: run `schema.sql` in phpMyAdmin against that DB.
|
||||||
|
3. **Add credentials**: copy `subscribe.config.example.php` to `subscribe.config.php`,
|
||||||
|
fill in the DB values, and upload it **one level above** the subdomain's docroot
|
||||||
|
(so it is never web-servable). `subscribe.php` looks there first.
|
||||||
|
4. **Deploy** the built `dist/` into the subdomain docroot. `subscribe.php` is already inside it.
|
||||||
|
5. **Smoke test**:
|
||||||
|
```
|
||||||
|
curl -i -X POST -H 'X-Requested-With: fetch' \
|
||||||
|
--data 'email=test@example.com' \
|
||||||
|
https://green-tea.expressive-tea.io/subscribe.php
|
||||||
|
```
|
||||||
|
Expect `{"ok":true,...}` and a row in `subscribers`.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- Duplicate signups are a silent success (unique index on `email`).
|
||||||
|
- A hidden honeypot field blocks basic bots.
|
||||||
|
- No-JS visitors are redirected to `/?subscribed=1`; with JS they get inline feedback.
|
||||||
|
- No rate limiting yet — add one at the cPanel/CDN layer if signups get abused.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- Launch-list table for subscribe.php. Run once against the green-tea DB.
|
||||||
|
CREATE TABLE IF NOT EXISTS subscribers (
|
||||||
|
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
email VARCHAR(254) NOT NULL UNIQUE,
|
||||||
|
created_at DATETIME NOT NULL,
|
||||||
|
ip VARCHAR(45) DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copy this to `subscribe.config.php` and fill in real values.
|
||||||
|
*
|
||||||
|
* Place the real file ONE LEVEL ABOVE the web root if you can (so it is never
|
||||||
|
* web-servable), e.g. /home/USER/subscribe.config.php when the docroot is
|
||||||
|
* /home/USER/green-tea.expressive-tea.io/. subscribe.php looks there first,
|
||||||
|
* then falls back to sitting next to it.
|
||||||
|
*
|
||||||
|
* Never commit the real subscribe.config.php — it holds the DB password.
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'dsn' => 'mysql:host=localhost;dbname=YOUR_DB;charset=utf8mb4',
|
||||||
|
'user' => 'YOUR_DB_USER',
|
||||||
|
'pass' => 'YOUR_DB_PASSWORD',
|
||||||
|
'notify' => 'support@expressive-tea.io', // set to '' to skip notification emails
|
||||||
|
];
|
||||||
@@ -3,14 +3,14 @@ const linkColumns = [
|
|||||||
{
|
{
|
||||||
heading: 'Learn',
|
heading: 'Learn',
|
||||||
links: [
|
links: [
|
||||||
{ label: 'Docs', href: 'https://docs.green-tea.dev', external: true },
|
{ label: 'Docs', href: 'https://green-tea.expressive-tea.io/docs', external: true },
|
||||||
{ label: 'Blog', href: '/blog', external: false },
|
{ label: 'Blog', href: '/blog', external: false },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
heading: 'Code',
|
heading: 'Code',
|
||||||
links: [
|
links: [
|
||||||
{ label: 'GitHub', href: 'https://github.com/green-tea-dev/green-tea', external: true },
|
{ label: 'GitHub', href: 'https://github.com/Expressive-Tea/green-tea', external: true },
|
||||||
{ label: 'npm', href: 'https://www.npmjs.com/package/@green-tea/core', external: true },
|
{ label: 'npm', href: 'https://www.npmjs.com/package/@green-tea/core', external: true },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -24,6 +24,7 @@ const year = new Date().getFullYear();
|
|||||||
<div class="site-footer__brand">
|
<div class="site-footer__brand">
|
||||||
<span class="site-footer__wordmark">Green Tea<span class="site-footer__dot">.</span></span>
|
<span class="site-footer__wordmark">Green Tea<span class="site-footer__dot">.</span></span>
|
||||||
<p class="site-footer__tagline">A zen, opinionated, type-safe framework.</p>
|
<p class="site-footer__tagline">A zen, opinionated, type-safe framework.</p>
|
||||||
|
<p class="site-footer__byline">by the Expressive Tea Team</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav class="site-footer__columns" aria-label="Footer">
|
<nav class="site-footer__columns" aria-label="Footer">
|
||||||
@@ -47,7 +48,7 @@ const year = new Date().getFullYear();
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wrap site-footer__bottom">
|
<div class="wrap site-footer__bottom">
|
||||||
<p>© {year} · MIT · That's the tea. 🍵</p>
|
<p>© {year} Expressive Tea Team · MIT · That's the tea. 🍵</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
@@ -82,6 +83,13 @@ const year = new Date().getFullYear();
|
|||||||
max-width: 26ch;
|
max-width: 26ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.site-footer__byline {
|
||||||
|
color: var(--matcha);
|
||||||
|
margin: 0.35em 0 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
.site-footer__columns {
|
.site-footer__columns {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 3.5rem;
|
gap: 3.5rem;
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
import logoUrl from '../assets/logo.svg?url';
|
import logoUrl from '../assets/logo.svg?url';
|
||||||
|
|
||||||
const navLinks = [
|
const navLinks = [
|
||||||
{ label: 'Docs', href: 'https://docs.green-tea.dev', external: true },
|
{ label: 'Docs', href: 'https://green-tea.expressive-tea.io/docs', external: true },
|
||||||
{ label: 'Blog', href: '/blog', external: false },
|
{ label: 'Blog', href: '/blog', external: false },
|
||||||
{ label: 'GitHub', href: 'https://github.com/green-tea-dev/green-tea', external: true },
|
{ label: 'GitHub', href: 'https://github.com/Expressive-Tea/green-tea', external: true },
|
||||||
{ label: 'npm', href: 'https://www.npmjs.com/package/@green-tea/core', external: true },
|
{ label: 'npm', href: 'https://www.npmjs.com/package/@green-tea/core', external: true },
|
||||||
];
|
];
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
---
|
||||||
|
// Beta-scoped objection handling. Answers stay honest: no benchmarks are
|
||||||
|
// invented, and every claim here matches what the rest of the site already says.
|
||||||
|
const items = [
|
||||||
|
{
|
||||||
|
q: 'Is Green Tea ready for production?',
|
||||||
|
a: `It's beta, on the RC track — the API can still shift between releases. It fits greenfield services, internal tools, and side projects where you own the deploy and can pin versions. If you need a decade of third-party middleware today, stay on Express for now.`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'Can I drop it into my existing Express app?',
|
||||||
|
a: `No — and that's the point. Green Tea replaces the middleware chain with a dependency graph, so adopting it means rewriting the pipeline, not swapping a router. It shines on a new service or a bounded rewrite, not as an incremental Express patch.`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'How does it perform against Express or Fastify?',
|
||||||
|
a: `Performance isn't the pitch — the model is — but there's a reproducible benchmark in the core repo (BENCHMARKS.md), written to be hard on us, not flattering. On a single-box harness green-tea keeps pace with Fastify and runs several times faster than Express, behind only raw Node http. Read the caveats there: it's loopback on one machine, so trust the ratios between frameworks, not the absolute numbers. The graph is topologically sorted once at boot, not per request — you don't pay for it on the hot path.`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'What will it add to my dependency tree?',
|
||||||
|
a: `One runtime dependency: reflect-metadata. ws and busboy are optional peers you install only if you use WebSockets or uploads. Validation is bring-your-own via Standard Schema (zod, valibot, or arktype), so the core stays lean.`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'Is mesh (multi-service) ready to use?',
|
||||||
|
a: `Not yet — mesh is alpha and gated behind an explicit opt-in. Build on the single-service core for now, and treat mesh as a preview, not a foundation.`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'What does "beta" mean for breaking changes?',
|
||||||
|
a: `Expect occasional breaking changes on the RC track, called out in the changelog. Pin your version and read the release notes before upgrading, and you won't be surprised.`,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
---
|
||||||
|
|
||||||
|
<section class="faq section--panel">
|
||||||
|
<div class="wrap faq__inner">
|
||||||
|
<div class="faq__head">
|
||||||
|
<p class="kicker">Straight answers</p>
|
||||||
|
<h2>Questions worth asking about a beta.</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="faq__list">
|
||||||
|
{
|
||||||
|
items.map((item) => (
|
||||||
|
<li class="faq__item">
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<span>{item.q}</span>
|
||||||
|
<span class="faq__mark" aria-hidden="true" />
|
||||||
|
</summary>
|
||||||
|
<p>{item.a}</p>
|
||||||
|
</details>
|
||||||
|
</li>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.faq__inner {
|
||||||
|
max-width: 720px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__head {
|
||||||
|
max-width: 52ch;
|
||||||
|
margin: 0 auto 2.5rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__head h2 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__list {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__item {
|
||||||
|
border: 1px solid color-mix(in srgb, var(--dim) 18%, transparent);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: var(--base);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__item summary {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.15rem 1.4rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--ink);
|
||||||
|
font-weight: 600;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* kill the native disclosure triangle across engines */
|
||||||
|
.faq__item summary::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__item summary:focus-visible {
|
||||||
|
outline: 2px solid var(--matcha);
|
||||||
|
outline-offset: -2px;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a + that rotates into an × when open — no icon asset needed */
|
||||||
|
.faq__mark {
|
||||||
|
position: relative;
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__mark::before,
|
||||||
|
.faq__mark::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
margin: auto;
|
||||||
|
background: var(--matcha);
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__mark::before {
|
||||||
|
width: 14px;
|
||||||
|
height: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__mark::after {
|
||||||
|
width: 2px;
|
||||||
|
height: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__item details[open] .faq__mark::after {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq__item details p {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 1.4rem 1.3rem;
|
||||||
|
color: var(--dim);
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -23,7 +23,9 @@ import GraphMotif from '../GraphMotif.astro';
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p class="graph-idea__punch">
|
<p class="graph-idea__punch">
|
||||||
This is pure composition. No other framework shows it, because no one else has the graph.
|
This is pure composition. DI frameworks resolve a graph of <em>services</em>; Green Tea resolves your <em
|
||||||
|
>request pipeline</em
|
||||||
|
> the same way — the steps a route runs are computed from what it asks for, not the order you wrote them in.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -11,18 +11,18 @@ import GraphMotif from '../GraphMotif.astro';
|
|||||||
<span class="hero__wordmark">Green Tea<span class="hero__dot">.</span></span>
|
<span class="hero__wordmark">Green Tea<span class="hero__dot">.</span></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>A zen, opinionated, type-safe framework.</h1>
|
<h1>Your API is a graph, not a middleware chain.</h1>
|
||||||
|
|
||||||
<p class="hero__subhead">
|
<p class="hero__subhead">
|
||||||
Your API is a graph, not a middleware chain. You declare what each step needs — the framework computes the
|
Green Tea is a zen, opinionated, type-safe framework: you declare what each step needs — it computes the
|
||||||
order. One runtime dependency. Runs wherever JavaScript runs.
|
order. One runtime dependency. Runs wherever JavaScript runs.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="btn-row hero__ctas">
|
<div class="btn-row hero__ctas">
|
||||||
<a class="btn btn--primary" href="https://docs.green-tea.dev" target="_blank" rel="noopener noreferrer">
|
<a class="btn btn--primary" href="https://green-tea.expressive-tea.io/docs" target="_blank" rel="noopener noreferrer">
|
||||||
Get started
|
Get started
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn--ghost" href="https://github.com/green-tea-dev/green-tea" target="_blank" rel="noopener noreferrer">
|
<a class="btn btn--ghost" href="https://github.com/Expressive-Tea/green-tea" target="_blank" rel="noopener noreferrer">
|
||||||
GitHub
|
GitHub
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn--ghost" href="https://www.npmjs.com/package/@green-tea/core" target="_blank" rel="noopener noreferrer">
|
<a class="btn btn--ghost" href="https://www.npmjs.com/package/@green-tea/core" target="_blank" rel="noopener noreferrer">
|
||||||
|
|||||||
@@ -10,11 +10,32 @@
|
|||||||
ergonomics. If you're tired of maintaining someone else's foundation, come try it.
|
ergonomics. If you're tired of maintaining someone else's foundation, come try it.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<form class="subscribe" action="/subscribe.php" method="post">
|
||||||
|
<p class="subscribe__lead">Not ready yet? Get one email when 1.0 ships — nothing else.</p>
|
||||||
|
<div class="subscribe__row">
|
||||||
|
<label class="sr-only" for="sub-email">Email address</label>
|
||||||
|
<input
|
||||||
|
id="sub-email"
|
||||||
|
class="subscribe__input"
|
||||||
|
type="email"
|
||||||
|
name="email"
|
||||||
|
required
|
||||||
|
maxlength="254"
|
||||||
|
placeholder="you@company.com"
|
||||||
|
autocomplete="email"
|
||||||
|
/>
|
||||||
|
<!-- honeypot: real people never fill this -->
|
||||||
|
<input class="subscribe__hp" type="text" name="website" tabindex="-1" autocomplete="off" aria-hidden="true" />
|
||||||
|
<button class="btn btn--primary" type="submit">Notify me at 1.0</button>
|
||||||
|
</div>
|
||||||
|
<p class="subscribe__msg" role="status" aria-live="polite"></p>
|
||||||
|
</form>
|
||||||
|
|
||||||
<div class="btn-row honest__ctas">
|
<div class="btn-row honest__ctas">
|
||||||
<a class="btn btn--primary" href="https://docs.green-tea.dev" target="_blank" rel="noopener noreferrer">
|
<a class="btn btn--primary" href="https://green-tea.expressive-tea.io/docs" target="_blank" rel="noopener noreferrer">
|
||||||
Read the docs
|
Read the docs
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn--ghost" href="https://github.com/green-tea-dev/green-tea" target="_blank" rel="noopener noreferrer">
|
<a class="btn btn--ghost" href="https://github.com/Expressive-Tea/green-tea" target="_blank" rel="noopener noreferrer">
|
||||||
Star on GitHub
|
Star on GitHub
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,4 +70,110 @@
|
|||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
color: var(--matcha);
|
color: var(--matcha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subscribe {
|
||||||
|
max-width: 30rem;
|
||||||
|
margin: 0 auto 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscribe__lead {
|
||||||
|
margin: 0 0 0.9rem;
|
||||||
|
color: var(--dim);
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscribe__row {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscribe__input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.7rem 0.9rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--dim) 35%, transparent);
|
||||||
|
background: var(--base);
|
||||||
|
color: var(--ink);
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscribe__input:focus-visible {
|
||||||
|
outline: 2px solid var(--matcha);
|
||||||
|
outline-offset: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* honeypot — kept in the layout for bots, off-screen for humans */
|
||||||
|
.subscribe__hp {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscribe__msg {
|
||||||
|
margin: 0.75rem 0 0;
|
||||||
|
min-height: 1.2em;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--matcha);
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscribe__msg[data-error] {
|
||||||
|
color: var(--violet);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sr-only {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.subscribe__row {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const form = document.querySelector('.subscribe');
|
||||||
|
if (form instanceof HTMLFormElement) {
|
||||||
|
const msg = form.querySelector('.subscribe__msg');
|
||||||
|
const button = form.querySelector('button');
|
||||||
|
form.addEventListener('submit', async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
if (button) button.disabled = true;
|
||||||
|
if (msg) {
|
||||||
|
msg.textContent = '';
|
||||||
|
delete msg.dataset.error;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await fetch(form.action, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'X-Requested-With': 'fetch' },
|
||||||
|
body: new FormData(form),
|
||||||
|
});
|
||||||
|
const data = await res.json().catch(() => ({ ok: res.ok, message: '' }));
|
||||||
|
if (msg) {
|
||||||
|
msg.textContent = data.message || (data.ok ? "You're on the list." : 'Something went wrong.');
|
||||||
|
if (!data.ok) msg.dataset.error = 'true';
|
||||||
|
}
|
||||||
|
if (data.ok) form.reset();
|
||||||
|
} catch {
|
||||||
|
if (msg) {
|
||||||
|
msg.textContent = 'Network error — try again.';
|
||||||
|
msg.dataset.error = 'true';
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (button) button.disabled = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
---
|
||||||
|
// Curated from the core README's comparison table — the rows that differ most, kept honest.
|
||||||
|
const cols = ['Express', 'Fastify', 'NestJS'];
|
||||||
|
const rows = [
|
||||||
|
{
|
||||||
|
label: 'The pipeline is',
|
||||||
|
others: ['a positional chain', 'hooks + plugins', 'DI + guards/interceptors'],
|
||||||
|
gt: 'a graph, topologically sorted',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Order comes from',
|
||||||
|
others: ['the line you wrote it on', 'hook phase + registration', 'module wiring'],
|
||||||
|
gt: 'what each step needs',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Is req.user there?',
|
||||||
|
others: ['hope so', 'hope so', 'if the guard ran'],
|
||||||
|
gt: 'boot fails if nothing provides it',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'See the pipeline',
|
||||||
|
others: ['read the code', 'read the code', 'paid Devtools'],
|
||||||
|
gt: 'explain / graph, free',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Real-time',
|
||||||
|
others: ['bolt on a ws/sse lib', 'a plugin', 'a separate gateway'],
|
||||||
|
gt: 'one AsyncIterable primitive',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Runs on',
|
||||||
|
others: ['Node', 'Node', 'Node'],
|
||||||
|
gt: 'Node · Deno · Bun · edge',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Runtime deps',
|
||||||
|
others: ['minimal', 'minimal', 'heavy (rxjs, …)'],
|
||||||
|
gt: 'reflect-metadata only',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
---
|
||||||
|
|
||||||
|
<section class="compare">
|
||||||
|
<div class="wrap">
|
||||||
|
<div class="compare__head">
|
||||||
|
<p class="kicker">How it compares</p>
|
||||||
|
<h2>Not another framework. A different model.</h2>
|
||||||
|
<p class="compare__lede">
|
||||||
|
Every framework here can serve <code>/users/:id</code>. The difference shows up as the app grows — more
|
||||||
|
dependencies, real-time, more than one machine.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="compare__scroll" role="region" aria-label="Framework comparison" tabindex="0">
|
||||||
|
<table class="compare__table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col"><span class="sr-only">Capability</span></th>
|
||||||
|
{cols.map((c) => <th scope="col">{c}</th>)}
|
||||||
|
<th scope="col" class="is-gt">Green Tea<span class="is-gt__dot">.</span></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{
|
||||||
|
rows.map((row) => (
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{row.label}</th>
|
||||||
|
{row.others.map((cell) => (
|
||||||
|
<td>{cell}</td>
|
||||||
|
))}
|
||||||
|
<td class="is-gt">{row.gt}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="compare__foot">
|
||||||
|
Same idea, said plainly: other stacks answer <em>“what does this handler depend on?”</em>, <em>“how do I push
|
||||||
|
data over time?”</em> and <em>“how do I call another service?”</em> with three subsystems. Green Tea answers
|
||||||
|
all three with one — the graph.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.compare {
|
||||||
|
/* the panel-vs-base rhythm alternates; this sits between two panels, so keep it base */
|
||||||
|
background: var(--base);
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__head {
|
||||||
|
max-width: 60ch;
|
||||||
|
margin: 0 auto 2.5rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__lede {
|
||||||
|
color: var(--dim);
|
||||||
|
font-size: 1.1rem;
|
||||||
|
margin: 0.75rem auto 0;
|
||||||
|
max-width: 54ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__lede code {
|
||||||
|
background: var(--panel);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0.15em 0.4em;
|
||||||
|
font-size: 0.9em;
|
||||||
|
color: var(--ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Horizontal scroll on narrow screens without ever scrolling the page body. */
|
||||||
|
.compare__scroll {
|
||||||
|
overflow-x: auto;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid rgba(139, 148, 158, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__scroll:focus-visible {
|
||||||
|
outline: 2px solid var(--matcha);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__table {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 720px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__table th,
|
||||||
|
.compare__table td {
|
||||||
|
padding: 0.85rem 1.1rem;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
border-bottom: 1px solid rgba(139, 148, 158, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* row headers (the capability being compared) */
|
||||||
|
.compare__table tbody th {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--ink);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* competitor cells read quiet */
|
||||||
|
.compare__table tbody td {
|
||||||
|
color: var(--dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__table thead th {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--dim);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
border-bottom-color: rgba(139, 148, 158, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the Green Tea column: lit, matcha, load-bearing */
|
||||||
|
.compare__table .is-gt {
|
||||||
|
background: rgba(95, 184, 138, 0.07);
|
||||||
|
color: var(--ink);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__table thead .is-gt {
|
||||||
|
color: var(--matcha);
|
||||||
|
font-weight: 700;
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
letter-spacing: 0;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-gt__dot {
|
||||||
|
color: var(--violet);
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__foot {
|
||||||
|
max-width: 62ch;
|
||||||
|
margin: 2rem auto 0;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--dim);
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compare__foot em {
|
||||||
|
color: var(--ink);
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sr-only {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -7,8 +7,10 @@
|
|||||||
<h2>One primitive for real-time.</h2>
|
<h2>One primitive for real-time.</h2>
|
||||||
|
|
||||||
<p class="realtime__body">
|
<p class="realtime__body">
|
||||||
SSE, ndjson, or a duplex WebSocket — return an <code>AsyncIterable</code>. One mental model, one line. No
|
SSE, ndjson, or a duplex WebSocket — one primitive, an <code>AsyncIterable</code>. You declare the transport
|
||||||
separate gateway, no bolt-on package.
|
with a decorator (<code>@Sse</code>, <code>@Ws</code>, <code>@Stream</code>); only that one line changes. No
|
||||||
|
separate gateway, no bolt-on package — and your wire contract is what you declared, never a surprise sprung by
|
||||||
|
a return value.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ const chips = ['app.listen(port)', 'serveDeno(app)', 'serveBun(app)', 'edgeHandl
|
|||||||
{chips.map((chip) => <li><code>{chip}</code></li>)}
|
{chips.map((chip) => <li><code>{chip}</code></li>)}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p class="runs__micro">Built on web standards. Not hostage to a runtime's fate.</p>
|
<p class="runs__micro">
|
||||||
|
Built on web standards. Not hostage to a runtime's fate. <span class="runs__caveat"
|
||||||
|
>(The edge has no filesystem, so file-backed views and static serving stay on the server runtimes.)</span
|
||||||
|
>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -68,4 +72,11 @@ const chips = ['app.listen(port)', 'serveDeno(app)', 'serveBun(app)', 'edgeHandl
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The caveat is true and belongs on the page, but it shouldn't outshout the claim. */
|
||||||
|
.runs__caveat {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -30,7 +30,7 @@ class MeController {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="see-it__code">
|
<div class="see-it__code">
|
||||||
<Code code={snippet} lang="ts" theme="github-dark" />
|
<Code code={snippet} lang="ts" theme="github-dark-high-contrast" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="see-it__caption">Declare what you need. The framework figures out the order.</p>
|
<p class="see-it__caption">Declare what you need. The framework figures out the order.</p>
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
title: "I benchmarked green-tea honestly. The network humbled it."
|
||||||
|
description: "Every framework claims it's faster. I put green-tea on two real machines with a real network between them and watched most of that story evaporate — plus the O(n²) I found in my own code while I was there."
|
||||||
|
pubDate: 2026-07-17
|
||||||
|
author: "Diego Reséndez"
|
||||||
|
tags: ["green-tea", "benchmarks", "honesty"]
|
||||||
|
---
|
||||||
|
|
||||||
|
Every framework's landing page has the same line: *mine is faster.* Usually there's a chart. Usually green bars, the author's framework on top.
|
||||||
|
|
||||||
|
I could show you that chart for green-tea. On a single machine, over loopback, it sits at the top of the pack — ahead of Express, ahead of Fastify. It's true. It's also the least honest number I could put in front of you. So let me tell you what happens when you stop benchmarking against yourself.
|
||||||
|
|
||||||
|
## The setup
|
||||||
|
|
||||||
|
Two bare-metal machines. One runs the server. The other does nothing but generate load. They're wired together on a real gigabit network, 0.2ms apart — not a laptop talking to itself over loopback, but the shape an actual deployment has: a client, a wire, a server.
|
||||||
|
|
||||||
|
## What the network does to the leaderboard
|
||||||
|
|
||||||
|
The moment there's a wire between client and server, two things happen. Every number drops, and the gaps between frameworks close.
|
||||||
|
|
||||||
|
| Framework | Requests/sec (two machines, 1GbE) |
|
||||||
|
| --- | --- |
|
||||||
|
| raw Node `http` (no framework) | 40,300 |
|
||||||
|
| Fastify | 34,000 |
|
||||||
|
| Nest (on Fastify) | 28,600 |
|
||||||
|
| **green-tea** | **28,200** |
|
||||||
|
| Express | 9,800 |
|
||||||
|
| Nest (on Express) | 8,900 |
|
||||||
|
|
||||||
|
Here's the uncomfortable part for anyone selling speed: at a realistic one-request-at-a-time load, the server sat nearly idle — single-digit CPU — while throughput flatlined. It wasn't the framework working hard. It was the round-trip. Add more connections and you only add latency; the ceiling doesn't move, because the bottleneck was never the framework. It was the network you'll actually deploy on.
|
||||||
|
|
||||||
|
So the "3× faster than Express" you see in loopback charts? That's a measurement of CPU overhead in a vacuum, and real traffic rarely lives there. Over the wire, green-tea lands right in the fast group — a hair behind Fastify, tied with Nest-on-Fastify, and still comfortably ahead of the Express-based stacks. Not *the* fastest. *With* the fastest. That's the honest sentence, and it's the one I'm comfortable shipping.
|
||||||
|
|
||||||
|
## The part no Node-only framework can show you
|
||||||
|
|
||||||
|
green-tea runs the same app on Node, Bun, and Deno — you swap the entry point, not the code. So I ran the identical app on all three:
|
||||||
|
|
||||||
|
| Runtime | Requests/sec (same green-tea app) |
|
||||||
|
| --- | --- |
|
||||||
|
| Deno | 44,800 |
|
||||||
|
| Bun | 44,100 |
|
||||||
|
| Node | 27,900 |
|
||||||
|
|
||||||
|
On normal traffic, Bun and Deno serve the same green-tea app at roughly 1.6× Node's throughput — free, for changing one line. An honest footnote: Bun's server actually gets *slower* under HTTP pipelining, and I'm not going to pretend I understand why yet — but I'm not going to hide it either. Deno scaled the cleanest.
|
||||||
|
|
||||||
|
Express, Fastify, and Nest can't play this game at all. They're Node-only. This is the one benchmark where green-tea isn't competing — it's alone.
|
||||||
|
|
||||||
|
## While I was here, I broke my own framework
|
||||||
|
|
||||||
|
Stress-testing is where you find the skeletons. I pushed a request pipeline to an absurd depth — far past anything a real app would build — and watched throughput fall off a cliff. That shouldn't happen: the graph is sorted once at boot, so running it should be cheap and linear in the number of steps.
|
||||||
|
|
||||||
|
It was quadratic. One line in the step runner rebuilt the *entire* request context on every step — copy the whole thing, every time, growing as it went. Harmless at three steps. Brutal at a hundred. I changed it to merge in place instead of rebuild: one line, O(n²) → O(n), and the deep case got 2.5× faster with the full test suite still green.
|
||||||
|
|
||||||
|
You will almost certainly never write a pipeline deep enough to have felt it. I fixed it anyway — because that's the job, and because I'd rather tell you I found it than have you find it.
|
||||||
|
|
||||||
|
## What I'm actually claiming
|
||||||
|
|
||||||
|
Not that green-tea is the fastest thing on the internet. Over a real network, "fastest framework" is mostly a rounding error — the wire has the final say, and everyone in the fast group is close. What green-tea gives you is a model that doesn't fight you, the same app on four runtimes, and someone who benchmarks it honestly enough to publish the parts that don't flatter it.
|
||||||
|
|
||||||
|
Performance is table stakes, and green-tea clears the bar. The reason to use it was never the benchmark.
|
||||||
|
|
||||||
|
That's the tea. 🍵
|
||||||
@@ -26,7 +26,7 @@ That's Green Tea.
|
|||||||
|
|
||||||
The core idea is simple to say and took a long time to get right: the request pipeline is an explicit dependency graph, not a mutable middleware chain. You don't push handlers onto a stack and hope the order holds. You declare what each step needs — `@needs('user')`, say — and the framework computes the order for you. There's no chain to get wrong, because there's no chain.
|
The core idea is simple to say and took a long time to get right: the request pipeline is an explicit dependency graph, not a mutable middleware chain. You don't push handlers onto a stack and hope the order holds. You declare what each step needs — `@needs('user')`, say — and the framework computes the order for you. There's no chain to get wrong, because there's no chain.
|
||||||
|
|
||||||
Real-time isn't bolted on either. It's one primitive: return an `AsyncIterable` and you have a stream, whether that stream is a WebSocket, an SSE connection, or something else entirely. One shape, one mental model, no separate package to reconcile with the rest of the framework.
|
Real-time isn't bolted on either. It's one primitive — an `AsyncIterable` — for every kind of stream: a WebSocket, an SSE connection, an ndjson feed. You declare which transport with a decorator and return the iterable; one shape, one mental model, no separate package to reconcile with the rest of the framework.
|
||||||
|
|
||||||
And because none of it depends on Express or Node's http module specifically, it runs on Node, on Deno, on Bun, and on the edge — built on web standards instead of one runtime's particular APIs. One runtime dependency, total. Not a supply chain, one dependency.
|
And because none of it depends on Express or Node's http module specifically, it runs on Node, on Deno, on Bun, and on the edge — built on web standards instead of one runtime's particular APIs. One runtime dependency, total. Not a supply chain, one dependency.
|
||||||
|
|
||||||
|
|||||||
+44
-7
@@ -3,20 +3,40 @@ import Header from '../components/Header.astro';
|
|||||||
import Footer from '../components/Footer.astro';
|
import Footer from '../components/Footer.astro';
|
||||||
import '../styles/global.css';
|
import '../styles/global.css';
|
||||||
|
|
||||||
|
type OpenGraphType = 'website' | 'article';
|
||||||
|
type StructuredData = Record<string, unknown>;
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
image?: string;
|
image?: string;
|
||||||
|
ogType?: OpenGraphType;
|
||||||
|
robots?: string;
|
||||||
|
publishedTime?: Date;
|
||||||
|
updatedTime?: Date;
|
||||||
|
authorUrl?: string;
|
||||||
|
tags?: string[];
|
||||||
|
structuredData?: StructuredData;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
title = 'Green Tea. — A zen, opinionated, type-safe framework.',
|
title = 'Green Tea — A zen, type-safe graph-pipeline HTTP framework',
|
||||||
description = 'Green Tea is a graph-pipeline HTTP framework: declare what you need, not the order to build it. Runtime-agnostic, type-safe, calm by design.',
|
description = 'Green Tea is a graph-pipeline HTTP framework: declare what you need, not the order to build it. Runtime-agnostic, type-safe, calm by design.',
|
||||||
image = '/og.png',
|
image = '/og.png',
|
||||||
|
ogType = 'website',
|
||||||
|
robots = 'index, follow',
|
||||||
|
publishedTime,
|
||||||
|
updatedTime,
|
||||||
|
authorUrl,
|
||||||
|
tags,
|
||||||
|
structuredData,
|
||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
|
|
||||||
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
|
||||||
const ogImageURL = new URL(image, Astro.site);
|
const ogImageURL = new URL(image, Astro.site).toString();
|
||||||
|
const serializedStructuredData = structuredData
|
||||||
|
? JSON.stringify(structuredData).replace(/</g, '\\u003c')
|
||||||
|
: undefined;
|
||||||
---
|
---
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
@@ -29,13 +49,24 @@ const ogImageURL = new URL(image, Astro.site);
|
|||||||
|
|
||||||
<title>{title}</title>
|
<title>{title}</title>
|
||||||
<meta name="description" content={description} />
|
<meta name="description" content={description} />
|
||||||
|
<meta name="robots" content={robots} />
|
||||||
|
|
||||||
<!-- Open Graph -->
|
<!-- Open Graph -->
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content={ogType} />
|
||||||
<meta property="og:url" content={canonicalURL} />
|
<meta property="og:url" content={canonicalURL} />
|
||||||
<meta property="og:title" content={title} />
|
<meta property="og:title" content={title} />
|
||||||
<meta property="og:description" content={description} />
|
<meta property="og:description" content={description} />
|
||||||
<meta property="og:image" content={ogImageURL} />
|
<meta property="og:image" content={ogImageURL} />
|
||||||
|
{
|
||||||
|
ogType === 'article' && (
|
||||||
|
<>
|
||||||
|
{publishedTime && <meta property="article:published_time" content={publishedTime.toISOString()} />}
|
||||||
|
{updatedTime && <meta property="article:modified_time" content={updatedTime.toISOString()} />}
|
||||||
|
{authorUrl && <meta property="article:author" content={authorUrl} />}
|
||||||
|
{tags?.map((tag) => <meta property="article:tag" content={tag} />)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
<!-- Twitter -->
|
<!-- Twitter -->
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
@@ -43,13 +74,19 @@ const ogImageURL = new URL(image, Astro.site);
|
|||||||
<meta name="twitter:description" content={description} />
|
<meta name="twitter:description" content={description} />
|
||||||
<meta name="twitter:image" content={ogImageURL} />
|
<meta name="twitter:image" content={ogImageURL} />
|
||||||
|
|
||||||
|
{serializedStructuredData && <script type="application/ld+json" set:html={serializedStructuredData} />}
|
||||||
|
|
||||||
<!-- RSS -->
|
<!-- RSS -->
|
||||||
<link rel="alternate" type="application/rss+xml" title="Green Tea. Blog" href="/rss.xml" />
|
<link rel="alternate" type="application/rss+xml" title="Green Tea. Blog" href="/rss.xml" />
|
||||||
|
|
||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
rel="preload"
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700&display=swap" rel="stylesheet" />
|
href="/fonts/zen-maru-gothic-latin-700.woff2"
|
||||||
|
as="font"
|
||||||
|
type="font/woff2"
|
||||||
|
crossorigin
|
||||||
|
/>
|
||||||
|
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
+31
-1
@@ -23,9 +23,39 @@ const dateFormat = new Intl.DateTimeFormat('en-US', {
|
|||||||
|
|
||||||
const wordCount = body.trim().split(/\s+/).filter(Boolean).length;
|
const wordCount = body.trim().split(/\s+/).filter(Boolean).length;
|
||||||
const readingTime = Math.max(1, Math.round(wordCount / 200));
|
const readingTime = Math.max(1, Math.round(wordCount / 200));
|
||||||
|
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
|
||||||
|
const heroImageURL = new URL(heroImage ?? '/og.png', Astro.site).toString();
|
||||||
|
const structuredData = {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'BlogPosting',
|
||||||
|
headline: title,
|
||||||
|
description,
|
||||||
|
image: heroImageURL,
|
||||||
|
datePublished: pubDate.toISOString(),
|
||||||
|
dateModified: (updatedDate ?? pubDate).toISOString(),
|
||||||
|
author: {
|
||||||
|
'@type': 'Person',
|
||||||
|
name: author,
|
||||||
|
},
|
||||||
|
publisher: {
|
||||||
|
'@type': 'Organization',
|
||||||
|
name: 'Expressive Tea Team',
|
||||||
|
},
|
||||||
|
mainEntityOfPage: canonicalURL,
|
||||||
|
...(tags && tags.length > 0 ? { keywords: tags.join(', ') } : {}),
|
||||||
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base title={`${title} — Green Tea. Blog`} description={description} image={heroImage}>
|
<Base
|
||||||
|
title={`${title} — Green Tea. Blog`}
|
||||||
|
description={description}
|
||||||
|
image={heroImage}
|
||||||
|
ogType="article"
|
||||||
|
publishedTime={pubDate}
|
||||||
|
updatedTime={updatedDate ?? pubDate}
|
||||||
|
tags={tags}
|
||||||
|
structuredData={structuredData}
|
||||||
|
>
|
||||||
<article class="post section">
|
<article class="post section">
|
||||||
<div class="wrap prose">
|
<div class="wrap prose">
|
||||||
<p class="post-nav"><a href="/blog/">← Back to the blog</a></p>
|
<p class="post-nav"><a href="/blog/">← Back to the blog</a></p>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ const title = '404 — Green Tea.';
|
|||||||
const description = 'This page steeped too long. It’s gone — but the rest of the garden is right here.';
|
const description = 'This page steeped too long. It’s gone — but the rest of the garden is right here.';
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base title={title} description={description}>
|
<Base title={title} description={description} robots="noindex, follow">
|
||||||
<section class="notfound section">
|
<section class="notfound section">
|
||||||
<div class="wrap notfound__inner">
|
<div class="wrap notfound__inner">
|
||||||
<div class="notfound__text">
|
<div class="notfound__text">
|
||||||
|
|||||||
+36
-2
@@ -2,23 +2,57 @@
|
|||||||
import Base from '../layouts/Base.astro';
|
import Base from '../layouts/Base.astro';
|
||||||
import Hero from '../components/sections/Hero.astro';
|
import Hero from '../components/sections/Hero.astro';
|
||||||
import GraphNotChain from '../components/sections/GraphNotChain.astro';
|
import GraphNotChain from '../components/sections/GraphNotChain.astro';
|
||||||
|
import HowItCompares from '../components/sections/HowItCompares.astro';
|
||||||
import RunsEverywhere from '../components/sections/RunsEverywhere.astro';
|
import RunsEverywhere from '../components/sections/RunsEverywhere.astro';
|
||||||
import RealTime from '../components/sections/RealTime.astro';
|
import RealTime from '../components/sections/RealTime.astro';
|
||||||
import Batteries from '../components/sections/Batteries.astro';
|
import Batteries from '../components/sections/Batteries.astro';
|
||||||
import SeeIt from '../components/sections/SeeIt.astro';
|
import SeeIt from '../components/sections/SeeIt.astro';
|
||||||
|
import Faq from '../components/sections/Faq.astro';
|
||||||
import HonestBeta from '../components/sections/HonestBeta.astro';
|
import HonestBeta from '../components/sections/HonestBeta.astro';
|
||||||
|
|
||||||
const title = 'Green Tea. — A zen, opinionated, type-safe framework';
|
const title = 'Green Tea — Type-safe graph-pipeline framework for Node, Deno & Bun';
|
||||||
const description =
|
const description =
|
||||||
'Your API is a graph, not a middleware chain. Declare what each step needs and Green Tea computes the order — one runtime dependency, type-safe, runtime-agnostic, calm by design.';
|
'Your API is a graph, not a middleware chain. Declare what each step needs and Green Tea computes the order — one runtime dependency, type-safe, runtime-agnostic, calm by design.';
|
||||||
|
const canonicalURL = new URL('/', Astro.site).toString();
|
||||||
|
const repositoryURL = 'https://github.com/Expressive-Tea/green-tea';
|
||||||
|
const structuredData = {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@graph': [
|
||||||
|
{
|
||||||
|
'@type': 'WebSite',
|
||||||
|
'@id': `${canonicalURL}#website`,
|
||||||
|
url: canonicalURL,
|
||||||
|
name: 'Green Tea',
|
||||||
|
description,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'@type': 'SoftwareApplication',
|
||||||
|
'@id': `${canonicalURL}#software`,
|
||||||
|
name: 'Green Tea',
|
||||||
|
description,
|
||||||
|
applicationCategory: 'DeveloperApplication',
|
||||||
|
operatingSystem: 'Cross-platform',
|
||||||
|
url: canonicalURL,
|
||||||
|
sameAs: repositoryURL,
|
||||||
|
license: `${repositoryURL}/blob/main/LICENSE`,
|
||||||
|
offers: {
|
||||||
|
'@type': 'Offer',
|
||||||
|
price: '0',
|
||||||
|
priceCurrency: 'USD',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base title={title} description={description}>
|
<Base title={title} description={description} structuredData={structuredData}>
|
||||||
<Hero />
|
<Hero />
|
||||||
<GraphNotChain />
|
<GraphNotChain />
|
||||||
|
<HowItCompares />
|
||||||
<RunsEverywhere />
|
<RunsEverywhere />
|
||||||
<RealTime />
|
<RealTime />
|
||||||
<Batteries />
|
<Batteries />
|
||||||
<SeeIt />
|
<SeeIt />
|
||||||
|
<Faq />
|
||||||
<HonestBeta />
|
<HonestBeta />
|
||||||
</Base>
|
</Base>
|
||||||
+21
-1
@@ -1,5 +1,25 @@
|
|||||||
/* Green Tea. — marketing site global styles */
|
/* Green Tea. — marketing site global styles */
|
||||||
@import './brand.css';
|
@font-face {
|
||||||
|
font-family: 'Zen Maru Gothic';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 500;
|
||||||
|
font-display: swap;
|
||||||
|
src: url('/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('/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 {
|
:root {
|
||||||
--base: #0d1117;
|
--base: #0d1117;
|
||||||
|
|||||||
Reference in new issue
Block a user