Generate the ecosystem catalogs from the docs instead of hardcoding them - #560
Conversation
The homepage ecosystem cards listed middleware, storage drivers, template
engines, and contrib packages from hardcoded arrays with rounded counts
("30+ drivers"), so every new package needed a manual edit.
Add a fiber-catalogs plugin that reads the four catalogs from the synced
docs at build time and publishes them as global data. The homepage now
renders exact counts and the package names from the docs themselves; the
per-card lists keep a featured ordering hint so recognizable packages lead,
while everything else follows alphabetically and the overflow chip shows the
real remainder ("+ 22 more"). Unknown ids in the hint are ignored, so adding
a package requires no homepage change.
The plugin is needed because the homepage build ships without any docs
plugin, so it cannot read the docs plugin global data the ecosystem
landscape uses. That landscape now derives its "30+ Middleware" core chip
from the catalog as well, and the storage/template/contrib card links point
at the canonical URLs instead of the /next/ redirects.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
…ges read Replaces the docusaurus plugin from the previous commit with a plain node script: scripts/generate-catalogs.mjs reads the docs folder and writes src/data/catalogs.json (id, display name, and doc path per package). It runs from the preinstall and pre-build hooks, so every install, dev start, and build refreshes it, and it needs no dependencies. Both surfaces now read that one file: - The homepage ecosystem cards render the exact count and every package of a catalog, so the featured lists and the "+ N more" cap are gone. Nothing about a package is written by hand anymore, only the card wording. - The ecosystem landscape drops its docs-plugin lookup (~55 lines of global data plumbing and URL regexes) for the same JSON, which also gives its chips the proper display names instead of raw doc ids. Middleware links keep the version prefix of the page the reader is on. The generated file is committed so the imports resolve without running the script first, and is excluded from the spell check. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
There was a problem hiding this comment.
Pull request overview
This PR replaces hardcoded ecosystem package lists/counts with a single generated data source derived from the docs/ tree. It centralizes catalog metadata in src/data/catalogs.json so both the homepage ecosystem cards and the ecosystem landscape render accurate package names and counts without manual updates.
Changes:
- Add a Node-only generator script (
scripts/generate-catalogs.mjs) that buildssrc/data/catalogs.jsonfrom the docs directories (and versioned middleware docs). - Update the homepage ecosystem cards (
Ecosystem.tsx) to render counts and chips fromcatalogs.json, removing curated lists and “+ many more”. - Update the ecosystem landscape (
fiber-landscape/index.tsx) to use the generated catalogs and keep version-prefixed middleware links; wire generation into npm lifecycle hooks and exclude the generated JSON from spellcheck.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/catalogs.ts | Adds TypeScript types for the generated catalogs JSON shape. |
| src/data/catalogs.json | Adds the generated, committed catalog data consumed by UI components. |
| src/components/home/Ecosystem.tsx | Switches homepage ecosystem cards to render counts/chips from generated catalogs. |
| src/components/home/Ecosystem.module.scss | Removes styling for the deleted “+ many more” chip variant. |
| src/components/fiber-landscape/index.tsx | Replaces docs-plugin global-data catalog plumbing with the generated catalogs JSON and version-aware middleware linking. |
| scripts/generate-catalogs.mjs | New generator that reads docs directories/front matter/headings and writes src/data/catalogs.json only when changed. |
| package.json | Runs catalog generation during install/start/build flows via pre* hooks and a dedicated script. |
| .cspell.json | Ignores the generated src/data/catalogs.json file for spellchecking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📝 WalkthroughWalkthroughThe PR adds a catalog generator that discovers package documentation and writes typed catalog data. The ecosystem cards and fiber landscape consume this data for package labels, counts, and version-aware links. ChangesCatalog integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Documentation
participant generate_catalogs.mjs
participant catalogs.json
participant Ecosystem
participant FiberLandscape
Documentation->>generate_catalogs.mjs: provide package documents and version metadata
generate_catalogs.mjs->>catalogs.json: generate sorted catalog data
catalogs.json->>Ecosystem: provide entries and counts
catalogs.json->>FiberLandscape: provide entries and counts
FiberLandscape->>FiberLandscape: resolve version-aware catalog links
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The file is derived from the docs folder, so tracking it only produces diff noise and can go stale against the docs it mirrors. It is now gitignored and written on the fly instead: the generator already ran from preinstall and the pre-build hooks, and typecheck gets one too so tsc can resolve the JSON import in a fresh checkout. Regenerating from scratch was verified for npm ci, npm install, typecheck, build:home and build:docs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
…ooks npm matches pre* hooks on the exact script name, so covering the builds took one hook per entry point (prebuild, prebuild:home, prebuild:docs) plus prestart and preinstall. Loading the generator from docusaurus.config.ts replaces all of them: the config is read at the start of every docusaurus command and long before webpack resolves the JSON import, so start, build, build:home, build:docs and a bare npx docusaurus call are all covered by one call that cannot be forgotten when a script is added. The script becomes a CommonJS module exporting generateCatalogs() and keeps working as a CLI. Only typecheck still generates on its own, because tsc never loads the config and would not resolve the import in a fresh checkout. Verified from a deleted catalogs.json: npm run check (typecheck, tests, both builds) regenerates it and passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
What does this PR change?
The homepage ecosystem cards listed middleware, storage drivers, template engines and contrib packages from hardcoded arrays with rounded counts (
30+ drivers,20+ packages), so every new package needed a manual edit insrc/components/home/Ecosystem.tsx.scripts/generate-catalogs.jsnow reads the four catalogs from thedocs/folder and writessrc/data/catalogs.json— per package its id, its display name (front mattertitle, else the first heading) and its doc path. A package is one page directly below a catalog root, the same rule the landscape used before, so nested pages likecontrib/socketio/legacystay part of their package. The middleware catalog is taken from the docs version served at the site root (newest entry ofversions.json).The generated file is not tracked in git.
docusaurus.config.tscalls the generator on load, which coversstart,build,build:home,build:docsand a barenpx docusauruscall in one place, long before webpack resolves the import — a new script cannot forget it. Onlytypecheckgenerates on its own, sincetscnever loads the config. The script needs no dependencies, only rewrites the file when its content changed, and is excluded from the spell check (that job installs dependencies, so the file exists there).Both surfaces read that one file:
Ecosystem.tsx): exact badge counts and every package of a catalog as chips. The curated item lists and the+ many morechip are gone; the file now only carries the wording of a card (icon, title, description, CTA).fiber-landscape/index.tsx): drops ~55 lines of docs-plugin global data plumbing and URL regexes for the same JSON. Chips now show proper display names (Redis,BasicAuth) instead of raw doc ids, and the hardcoded30+ Middlewarecore chip derives its count as well. Middleware links keep the version prefix of the page the reader is on (/next/middleware/…on the Next docs).The homepage build ships without any docs plugin, which is why the data comes from a generated file rather than the docs plugin global data the landscape used before.
Current numbers: 32 middleware, 34 storage drivers, 9 template engines, 22 contrib packages. Storage includes
mockstorageandtesthelpers, exactly as the landscape counted them before.Also switches the storage, template and contrib card links from the
/next/redirects to the canonical URLs.Verified with a deleted
catalogs.jsonthatnpm run check(typecheck, matcher tests, both builds) regenerates it and passes, and by rendering the homepage and the ecosystem page from the production build.