Repository navigation
feat(docs): render the API pages with Nimbus - #91
Draft
MohamedH1998 wants to merge 20 commits into
Draft
MohamedH1998 wants to merge 20 commits into
MohamedH1998 wants to merge 20 commits into
Conversation
# Conflicts: # packages/cloudflare-api-site/README.md # packages/cloudflare-api-site/e2e/site.e2e.ts # packages/cloudflare-api-site/e2e/visual.e2e.ts # packages/cloudflare-api-site/src/api-server.ts # packages/cloudflare-api-site/src/pages/[product]/llms.txt.ts # packages/cloudflare-api-site/src/pages/llms.txt.ts # pnpm-lock.yaml
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves the API site's operation pages, Markdown twins and
llms.txtfrom the site's own routing and page components to Nimbus.astro-fernstill decides products, resources and URLs. A small adapter,prepareForgeApi, turns its output into the spec Nimbus renders.Pages are 2–8× lighter and served 3–5× faster. In exchange, builds take longer: a cached rebuild takes about twice as long as
main's, and preview starts in 13 s against 5 s.This PR carries the Nimbus 0.19 upgrade from #68.
mainis merged in, and the sample picker keepsmain's cf CLI, curl and Terraform, with cf CLI first.Changes
Rendering
src/forge-api.ts). Adds Cloudflare titles, lifecycle order, request samples, response examples and Terraform data to the spec. Terraform is one sample joining every declaration example, as onmain.astro.config.mjsruns the adapter when the config loads and writes the spec, products and redirects to the git-ignored.forge/. TheastroFernintegration is removed.llms.txt, per-sectionllms.txt,llms-full.txtand/<page>/index.md. Thedocsand live collections become Nimbus'sapiandapiPages.@cloudflare/nimbus-docs0.19.3,openapi-samplerand@scalar/openapi-parseradded;@astrojs/prismremoved. Nimbus 0.19.3 is exempt from the workspace's minimum release age.Components
src/components/ui/, with the building blocks they use: collapsible, layer card, pagination, popover, sidebar and version switcher. The site owns these files and edits them for Cloudflare: availability notices, Terraform, library cards on the home page, and the tooling sidebar.src/components/ui/**andsrc/lib/**are excluded from oxlint and oxfmt, so starter updates apply cleanly.What looks different from
mainURLs and agent files
maindrops, redirect to their primary page with a 302, as do old section and moved-product URLs. A build fails if an alias has no primary page./<page>.md301s to/<page>/index.md.titleandversion. The description isn't repeated there, since the body has it.main's twins have none.llms.txtis nowtext/plain, nottext/markdown.?lang=only picks the sample shown first, and unknown values no longer 404. Per-language Markdown andllms.txtare gone. The Terraform sample's id is nowhcl./api/index.mdxis gone, because the home page moved into the API layout.Other
--ignore-lock, and there's a newoperation-terraformvisual shot.Validation
pnpm check,pnpm typecheckandpnpm -r run test(459 passed).astro check(0 errors),buildandtest:e2e(38 passed). The end-to-end tests cover the sample picker, the redirects, the Markdown andllms.txtroutes and the Terraform section.mainat 1440 px: endpoint box, code rail scrolling, tab order and focus rings, parameter links, and long descriptions in light and dark mode.Performance against
main. Both built locally from spec releaseopenapi@bdea3bc5. Server times are medians of 15 requests; browser figures are medians of 3 loads.mainNimbus prepares data for every page at build time, which is what makes pages faster, and caches that work between builds. The remaining rebuild gap is mostly Astro's server build, about 40 s against 20 s on
main.