Repository navigation
feat(www): port the v12 website onto main, with v11 content - #7771
Conversation
Co-authored-by: alexander <[email protected]>
…@shared/ui/theme.css Co-authored-by: alexander <[email protected]>
Co-authored-by: alexander <[email protected]>
…ght-click to /media, www tests Co-authored-by: alexander <[email protected]>
…ercel/turbo config, CI checks Co-authored-by: alexander <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
Important Review skippedToo many files! This PR contains 562 files, which is 262 over the limit of 300. To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch. Usage-priced reviews support at most 300 files.
|
Co-authored-by: alexander <[email protected]>
…n's lockfile Co-authored-by: alexander <[email protected]>
…eaves them alone Reverts autofix-ci's manypkg fix, which downgraded effect to 3 and tailwindcss to 3 for the site and changed examples' ranges. Co-authored-by: alexander <[email protected]>
Co-authored-by: alexander <[email protected]>
Co-authored-by: alexander <[email protected]>
…ns; delete www/og-image (#7782) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Why - trpc.io's social cards came from a second Next.js app, `www/og-image`, on its own Vercel project. The new site (#7771) can draw them itself, so one project and one deploy is enough. - Previews should show their own cards, not production's. ## What - `/og/<page path>.png` (`/og/index.png` for the home page) is drawn on request by `www/src/routes/og.$.ts`, with satori and `@resvg/resvg-wasm`. Fonts, logo and wasm are inlined, so the function needs no files of its own. - The card list (`build/og-cards.ts`, virtual module `virtual:og-cards`) is made at build time. A path with no card is a 404. - The designs are the old service's, ported to the new renderer, not modernized: - Home: logo, tagline, subtitle, live GitHub stars and `@trpc/server`'s npm weekly downloads. - Post: date, title, description, reading time, and each author's avatar, name and title. An avatar that doesn't load shows the author's initials. - Docs: logo, title, description and URL. The old service had no card for the blog index, sponsor, media or search pages, so they use this one. The sponsor card drops the partner logos the new site's card had. - Live data is fetched when a card is drawn: GitHub's repo API (with `GITHUB_TOKEN` if set) and npm's downloads API, plus avatars at 128 px. Each fetch has a 4 s timeout; a failed one is left off the card. - Caching: - Home card: `s-maxage=86400, stale-while-revalidate=3600`, so the numbers are about a day old at most. - A card missing something it fetched: `s-maxage=600`, so the next request soon tries again. - Every other card: cached like a page. - The function now keeps a response's own `Cache-Control` instead of always setting the page one. - `og:image` and `twitter:image` are absolute URLs on the deployment's own host, decided at build time from `VERCEL_ENV`. Production uses `https://trpc.io`. A preview uses `VERCEL_BRANCH_URL`, falling back to `VERCEL_URL`. `og:url` and the canonical link stay on trpc.io. - Deployment Protection is off on the `www` project (no Vercel Authentication, password or trusted IPs), so crawlers can fetch a preview's cards. - Deleted `www/og-image`, plus its references in CI, `.oxlintrc.json`, `scripts/preview-urls.ts` and the PR template (which now describes `/og/<page path>.png` on `www`). - **Lockfile:** without `www/og-image`'s importer, pnpm moved `@trpc/tanstack-react-query`'s vitest onto vite 8.3.5. That made a second vitest copy, which `@testing-library/jest-dom/vitest`'s matcher types don't extend, so `typecheck` failed. The lockfile keeps that package on the root's vitest, as in #7771, and drops the copy nothing uses. Otherwise the lockfile only drops `www/og-image`'s dependencies and `@fontsource/jetbrains-mono`, and adds `@resvg/resvg-wasm`. - **For you:** the `og-image` Vercel project is untouched. Remove it once this is merged. - **Follow-up:** a PR to modernize the card designs, and maybe add a light-mode variant. - **Conflict:** #7778 (new logo) edits `www/og-image/*`, `www/build/og-image.ts` and `www/build/og/pattern.svg`. This PR deletes or replaces all three: the cards move to `www/src/og/`, in the old designs with the old pattern. Whichever merges second keeps this PR's side of those files. The cards draw their logo from `public/favicon.svg`, which #7778 updates, so they get the new logo without further edits. ## Links Each card's image, next to a page that uses it: - Home: [page](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/index.png): live stars and downloads. - Docs: [Introduction](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/docs), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/docs.png) - v10 docs: [React Query Integration](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/docs/v10/client/react), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/docs/v10/client/react.png) - A post with two authors: [Introducing the new TanStack React Query integration](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/blog/introducing-tanstack-react-query-client), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/blog/introducing-tanstack-react-query-client.png) - Blog index: [page](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/blog), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/blog.png) - Sponsor: [page](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/sponsor), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/sponsor.png) - Media: [page](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/media), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/media.png) - Search: [page](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/search), [card](https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/search.png) Local renders:     ## Alternatives considered - Keep `www/og-image`: two projects and two deploys for one site, and previews would still show production's cards. - Render every card at build time: the stars and downloads would only update on a deploy, and the build would draw about 600 PNGs. - A `/docs.png`-style URL beside each page: dropped to keep the existing `/og/<page path>.png` scheme. - For the lockfile, bumping the catalog's `vite` to `^8.3.5` instead: pnpm then re-resolved every catalog consumer and moved the packages from React 19.1.0 to 19.3.0 and zod 4.2.1 to 4.6.7. `pnpm dedupe` rewrote about 4,700 lines. ## Testing - New tests: - `src/og/live.test.ts`: stats, failed fetches, avatars, cache headers. - `src/seo.test.ts`: deployment origin; `og:image` on the preview host while `og:url` stays on trpc.io. - `src/og/render.test.ts`: each card type renders, and home renders without numbers. - `src/og/card.test.ts`: text helpers. - `build/on-demand.test.ts`: a response's own caching wins. - `www` tests: 257 passed. Lint, oxfmt and `tsc` are clean. - `pnpm typecheck-packages` passes, and `pnpm install --lockfile-only` leaves the lockfile unchanged. - `pnpm turbo --filter www build` passes, and the legacy-URL check says all 699 of trpc.io's URLs work on the output. - Called the built `_ssr` function directly: - `/og/index.png` gave 200 with the one-day cache. - The v10 doc and two-author post cards gave 200. - An unknown card gave 404. - The production build's HTML has `og:image` `https://trpc.io/og/index.png`. - On this PR's preview, with no credentials, each card under "Links" returns a 200 PNG, and the home card shows the live numbers. - The home, v10 doc and post pages there have `og:image` and `twitter:image` on `https://www-git-cursor-www-og-routes-28db-trpc.vercel.app/og/...png`, with `og:url` and the canonical link on `https://trpc.io/...`. - CI passes, except `Vercel – og-image`, which fails because its root directory is deleted. Removing that project, as noted above, clears it. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-927521a8-1313-5f37-b0a9-b2b90abc28db?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-927521a8-1313-5f37-b0a9-b2b90abc28db&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7782?autoLogin=true&ref=codesmith_pr_footer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png" width="162" height="28"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796162988&installation_model_id=443568&pr_number=7782&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7782&signature=7769735b72bbf76f203e75861f8173324d21bd8050e757ea0870098cc796c8ea"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> --------- Co-authored-by: Cursor Agent <[email protected]>
…any host ending in githubusercontent.com Co-authored-by: alexander <[email protected]>
…me page hero, in place of "Read the docs" As main's GithubStarsButton: the count is fetched from GitHub's API in the browser and fades in when it arrives. Its slot is reserved, so the button keeps its width before the count loads and when the fetch fails, and the fade is off under prefers-reduced-motion. Co-authored-by: alexander <[email protected]>
trpc-bot
left a comment
There was a problem hiding this comment.
Required checks are green, every review thread is resolved, and the star CTA, description update and stacked rebases are pushed.
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Why
main, with main's v11 docs, blog and pages as the content.www, with a layout close to v12's, so it can later be merged back into v12.What
wwwis now v12's site (TanStack Start + Vite, Tailwind 4, Effect build scripts, Shiki + Twoslash), with v12-only features removed (v12 docs, demos, codemods, experiments menu).www/v11/docs, v10's inwww/v10/docs, v9's inwww/v9/docs, and the blog inwww/blog.:::admonitions, HTML comments,twoslash includeblocks and partials. The site reads it at render time (www/build/docusaurus-syntax.ts), so the files stay close to main's and git sees renames.section,parentandorder, which build the sidebar thatsidebars.jsused to. v10 and v9 links to GitHub point at their release tag rather thanmain./docs/v10/...and/docs/v9/.... See "URL changes" for the few redirects that changed.docsLinkslist. The right side has GitHub, X, Discord, the version picker, the theme toggle, then search.v11); the menu still says which versions are unmaintained.@shared/ui, intooling/ui, is a workspace package that the site and the examples can depend on ("@shared/ui": "workspace:*").@shared/ui/globals.cssgives the full styling, at about 230 kB (32 kB gzipped).@shared/ui/theme.cssgives only the tokens, so consumers can scan just the components they use:www.catalogs.www.manypkgskipscatalog:specifiers, so its "most common range" fix no longer rewrites the site's or the examples' versions.reactandreact-dom(^19.1.0, as main resolves them). Without them,@testing-library/reactin the package tests picked up the site's React 19.3 and failed.www/samples/v11against the workspace@trpc/*packages.pnpm --filter www check-twoslashchecks every Twoslash block in the docs and blog. A partial'stwoslash includeblocks apply only inside that partial, as Docusaurus had it.www/api-referenceruns TypeDoc with main's versions and options.convert.tsturns the output into pages at the same/docs/typedoc/...paths, in a collapsed "API Reference" sidebar section.llms.txt, as on main.lastmod. The build fails if a prerendered page is missing from it, except/404andnoindexpages (www/build/vercel-output.ts).www/build/legacy-urls-check.tsruns at the end of the build. It sends each of trpc.io's sitemap URLs (www/build/trpc-io-urls.txt) and eachvercel.jsonredirect source through the built routes, and fails if one doesn't land on a page.--base <url>runs the same check against a deploy./media: the page is kept, and right-clicking the logo opens it, as on main..github/workflows/sponsors.ymlruns daily and on demand.www/build/sponsors-sync.ts, which updateswww/sponsors.jsonand the README's sponsors section from GitHub Sponsors.mainonly when a sponsor joins, leaves or changes tier.secrets.ACCESS_TOKEN, asrelease.ymldoes: the "main" rule set rejects pushes made withGITHUB_TOKEN.www/vercel.jsonbuilds withcd .. && pnpm turbo --filter www buildinto.vercel/output(Build Output API).www/vercel.json, in main's order and format; the build turns them into routes.prefers-reduced-motionit just appears./og/<page path>.png(/og/index.pngfor the home page) is drawn on request bywww/src/routes/og.$.ts, with satori and@resvg/resvg-wasm. The card list is made at build time, and a path with no card is a 404.og-imageservice's, not modernized:@trpc/server's npm weekly downloads.github.comor a*.githubusercontent.comhost, checked on the URL's hostname) are fetched at 128 px.og:imageandtwitter:imageare on the deployment's own host:https://trpc.ioin production, the preview's URL on a preview.og:urland the canonical link stay on trpc.io.wwwproject, so crawlers can fetch a preview's cards.www/og-imageis deleted, with its references in CI,.oxlintrc.json,scripts/preview-urls.tsand the PR template.www/og-image's importer, pnpm moved@trpc/tanstack-react-query's vitest onto vite 8.3.5. That made a second vitest copy, which@testing-library/jest-dom/vitest's matcher types don't extend, sotypecheckfailed. The lockfile keeps that package on the root's vitest and drops the copy nothing uses.typecheck-wwwalso runs the www tests and the Twoslash check.tailwindcssdevDependency lets oxfmt sort classes against the v4 stylesheet.Renames
Against main,
wwwhas 205 renames (18 of them unchanged), 174 added files, 85 deleted and 4 modified.Twenty-one docs pages can't be renames, so git shows them as deleted and added:
Pages that were MDX stubs around a shared partial:
community/contributing,community/loveandcommunity/sponsorsin v11 and v10;contributing,loveandsponsors;main/conceptsandmain/videos-and-community-resourcesin v11 and v10.Each stub only imported a file from
www/unversionedor a partial. The new page holds that content itself, so no single old file is more than half of it.server/adapters-intro.md, in v11 and v10: it's nowserver/adapters.md, named for its URL (/docs/server/adapters), and its relative links became absolute. That leaves it under git's 50% similarity.Pages that are gone, with their URLs redirecting:
landing-intro/Step1–Step3andtest-sub._import-approuterwas a partial that's now inlined.The other added files are the site's own code, the generated API reference, and the samples.
Docs and blog changes
On top of the frontmatter and link changes above, the only content changes are:
blog/tinyrpc-client.md:// ^? provide…became// ^ provide…. The?made Twoslash read the comment as a type query, which doesn't compile.v11/sections.json: an "API Reference" sidebar section for the generated TypeDoc pages./docs/typedoc.v12 content that had leaked into the port has been removed: the sponsor page's "v12 is a rewrite" section, the home page's social card (v12 pill and install command), and READMEs and comments pointing at v12's paths.
URL changes
Main's redirects are kept, except:
/docs/client→/docs/client/introduction: it hid v11's client overview page./sponsor→ GitHub Sponsors:/sponsoris now the site's sponsor page, which replaces/pricing./docs/aborting-procedures→/docs/client/vanilla/aborting-procedure-calls/docs/extra→/docs/further-reading/docs/server/api-handler→/docs/server/adapters/v10/docs/*→/docs/v10/*and/v9/docs/*→/docs/v9/*, for anyone who used the v12 site's paths./docs/introduction,/docs/v10/introductionand/docs/v9/introduction→ each version's base path (/docs,/docs/v10,/docs/v9), where the first page is served./pricingand/sponsors→/sponsor./blog/archiveand/blog/authors→/blog./docs/landing-intro/*,/docs/v10/landing-intro/*and/docs/test→/.index.htmlredirect to the path without them.Needs setup
SPONSORS_SYNC_GITHUB_TOKEN, a classic token of KATT's withread:userandread:org. Without it, the workflow skips with a warning.wwwproject: check that the dashboard doesn't overridevercel.json's framework, install command or build command.og-imageVercel project. It's untouched, and its root directory,www/og-image, is gone, so its check fails on every PR until it's removed.Follow-ups
@trpc/*packages for the API reference, with nothing cached between builds. Turbo's remote cache or caching the TypeDoc output would cut most of that.Links
/media.@trpc/server/v10/docs/client/reactgoes to/docs/v10/client/react.Social cards, each next to a page that uses it:
Alternatives considered
www. That would break the Vercel project and make the later merge back into v12 harder.@shared/uiinwww/shared/ui, as on v12. The examples use it too, so it now lives intooling/ui./v10/docsand/v9/docs, as v12 does. That would move 111 of trpc.io's URLs behind redirects. They stay at/docs/v10and/docs/v9.www/og-imagefor the social cards. That's two Vercel projects and two deploys for one site, and previews would show production's cards. Drawing every card at build time instead would freeze the stars and downloads between deploys.lastmodfrom git history. The port's moves and reformats made the dates unreliable for most pages, and a wrong date is worse than none.Testing
pnpm turbo --filter www buildpasses, including the sitemap check and the old-URL check: "All 699 of trpc.io's URLs work on .vercel/output".node build/legacy-urls-check.ts --base https://www-git-cursor-port-v12-website-28db-trpc.vercel.app: all 699 URLs work on the preview.pnpm typecheck-www(site, samples,@shared/ui): no errors.pnpm --filter www test: 257 tests pass, with new ones for the Docusaurus syntax, the old-URL check, partials' Twoslash includes, the social cards, and the avatar host check (a lookalike host such asevilgithubusercontent.comisn't treated as GitHub's).pnpm --filter www check-twoslash: all 397 blocks in 467 files compile.pnpm manypkg check,pnpm oxfmt --check .andpnpm lintpass.curlon the current preview: each page under "Links" returns 200, and the redirects listed there return 308 to the right page./docs/v10, light and dark, at 1280px and 390px:/sponsorand/media./media.useQueryto the v10 page./docshasog:imagehttps://www-git-cursor-port-v12-website-28db-trpc.vercel.app/og/docs.png.Vercel – og-image, which fails becausewww/og-imageis deleted. Deleting that Vercel project clears it."Star" button on the preview, desktop and phone:
Social cards (local renders):
Need help on this PR? Tag
@codesmith-botwith what you need.