Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
15252cc to
c2d0e3c
Compare
21d1491 to
73ad076
Compare
e7608ad to
21967ab
Compare
The one-deploy build (build-versioned.mjs) exports canary as a static site (output:'export'), but several routes used features that force dynamic rendering, so the export failed. Verified by running the canary export to completion: it now prerenders all 268 pages and emits out/ with basePath /canary baked into asset URLs. Fixes, each keeping the LATEST server build identical: - robots.ts / sitemap.ts: add `export const dynamic = 'force-static'`. Both are already build-time static (derived from generated registries + SITE_URL); the export just needs them declared static to emit robots.txt / sitemap.xml. - themes/page.tsx: read `?theme=` on the client instead of server `await searchParams` (which forces dynamic rendering). Split into a server page (keeps metadata) + a client ThemesExplorer that resolves the deep-link seed via useSearchParams, wrapped in Suspense. Deep links still preselect the picker; the read just happens in the browser. - templates/page.tsx: wrap the useSearchParams client body in a Suspense boundary (required by the static export; the server build tolerated its absence). Other useSearchParams consumers already sit under a Suspense ancestor (PlaygroundClient, ComponentDetailClient, ThemesExplorer) so no change needed.
The Vercel build failed with `fatal: invalid object name 'v0.1.2'`: the latest resolver materialized the pinned release from a git tag (git show/git archive), but Vercel builds on a shallow checkout with no tags, so the tag doesn't exist there. Switch the pin to the published npm tarballs. npm is always reachable on the build, and the tarballs ship src/ (so the .doc.mjs docs the pipeline reads are present). resolve-content-root.mjs now downloads each pinned package via `npm pack @pkg@version`, extracts it into a synthetic workspace (<cache>/packages/{core,cli}, <cache>/packages/themes/<name>) with a synthetic root package.json, and points the pipeline there. versions.json pins by npm version + an explicit {name, dir} package list instead of a git tag. This also corrects a latent bug in the old git-archive path: it copied packages/lab from the tag, so "latest" listed ~25 lab components that are never published (lab is fork-to-use, not distributed). The npm pin only includes actually-published packages, so latest now reflects exactly what `npm install` provides (191 components vs main's 219 = 3 post-release core additions + 25 unpublished lab components).
The latest (pinned) build failed `tsc` with errors like "Property 'hasAutoFocus' does not exist on type 'DropdownMenuProps'" in src/generated/showcases/*. Root cause is inherent to the dual-version design: the docsite typechecks against main's @xds/core types, but the `latest` build snapshots content from a published release (0.1.2). When a public prop is removed/renamed between the pin and main (hasAutoFocus was dropped from DropdownMenu/MoreMenu's public props after 0.1.2), the release's own showcase templates legitimately use API that main's types no longer expose. A tsconfig `exclude` does NOT fix this: showcaseRegistry/exampleRegistry dynamically `import()` these files, so tsc checks them regardless of exclude (verified). Instead, the generator now prepends `// @ts-nocheck` to the generated showcase/example snapshots ONLY for the `latest` (pinned) build, via a copyContentFile() helper. These are version-pinned content snapshots, not docsite-authored code, so skipping type-checking on them is correct — they can't be edited to match newer types. The `canary` build reads main's own templates against main's types and is copied verbatim, keeping full type coverage. This structurally fixes the class of failure (pinned content vs newer code), not just the hasAutoFocus instance — any future removed/renamed public prop in a release predating main is now handled.
…inned source Supersedes the @ts-nocheck approach (reverted here), which was wrong: it hid a type error that was actually a real runtime bug. The latest build pins CONTENT to a release (0.1.2) but the docsite bundles ONE @xds/core — main — resolved from node_modules. Showcases/examples are live-rendered React (dynamic import()), so a pinned 0.1.2 demo using a prop main removed (hasAutoFocus on DropdownMenu/MoreMenu) doesn't just fail tsc — it would break at runtime against main's component. @ts-nocheck would have silenced the type error and shipped the runtime break (and ESLint bans @ts-nocheck + the copyright-header rule anyway, so it failed lint too). Correct split: DATA vs EXECUTABLE content have opposite pinning needs. - DATA (component .doc.mjs prop tables, package.json versions, READMEs): pinned to the release — this is the point of `latest` (191 documented components, no unreleased props/components). - EXECUTABLE content (CLI templates — showcases, examples, blocks, pages, docs): always from the workspace (main), matching the bundled core. Demos render and typecheck against the exact runtime they use. Implementation: resolveContentRoot() for `latest` keeps contentRoot pinned (npm tarballs) but points cliRoot at the real workspace packages/cli. No generator escape hatches; showcases are copied verbatim again and typecheck cleanly (verified tsc: 0 errors). canary unchanged (both roots = workspace).
…n build Rebased onto main, which added docsite features that interact with the one-deploy build: - New route handlers /rss.xml and /blog/txt/[slug] (plus existing /mcp) are server-only and can't be statically exported. build-versioned.mjs now auto-discovers and stashes ALL route.ts/route.tsx for the canary export pass (restoring them after), instead of hardcoding just /mcp — so a route added on main can't silently break the export. Verified: canary export completes, all three routes stashed and restored. - main added next.config `rewrites()` (for /blog/<slug>.txt). rewrites requires the server runtime and is unsupported under output:'export', so it's applied to the latest (server) build only; the canary static export omits it. Data stays pinned (191 components); executable content (now including main's new Kanban template) comes from the workspace as intended. tsc clean for both targets; eslint + check:repo verified manually.
… export The rebased build stashed each route.ts individually but left the now-empty route-segment directory behind (e.g. `blog/txt/[slug]/`, `rss.xml/`, `mcp/`). An empty dynamic segment like `[slug]/` makes Next's static export choke during "Collecting page data" / route collection — which is why the post-rebase Vercel deploy failed there while all GitHub CI (lint/build/test) stayed green (CI runs `next build` on the server target, which never stashes routes). The pre-rebase MCP-only logic moved the whole `mcp/` directory, so nothing was left behind. Restore that property generally: after moving each route file, prune the emptied directory and any now-empty ancestors up to src/app. Restore puts every handler back for the latest (server) build. Verified locally: the canary export now clears route collection and reaches "Generating static pages (67/270)" before the 4GB sandbox OOM-kills it (a RAM ceiling, not an error — dmesg-confirmed); route collection was the failing gate and it now passes. Simulated stash+prune leaves zero empty dirs and restores all three handlers.
…workspace The rebase pulled in main's `chore: enforce pnpm via devEngines.packageManager` (#3304), which adds `devEngines.packageManager: {name: pnpm, onFail: error}` to the root package.json. The latest build's content resolver shells out to `npm pack @astryxdesign/<pkg>@0.1.2` to materialize the pinned tarballs — and it ran with cwd inside the workspace, so npm discovered that manifest and hard-errored: npm error code EBADDEVENGINES npm error Invalid name "pnpm" does not match "npm" for "packageManager" This is the real post-rebase Vercel regression: the pre-rebase green build (15252cc) used the identical `npm pack` resolver but predated the devEngines guard, so it passed; the rebase introduced the guard. `.content-cache/` is gitignored, so Vercel's fresh checkout always runs `npm pack` cold — the error is deterministic there. Fix: invoke `npm pack` from the temp destination dir (outside the repo), so npm never discovers the workspace package.json and skips the engine guard; also set COREPACK_ENABLE_STRICT=0 as belt-and-suspenders. Verified: resolver exits 0 with no EBADDEVENGINES, materializes all 8 pinned packages, latest generate produces the pinned 191-component set. (Local full `next build` still can't complete on the 4GB sandbox — RAM ceiling, not a code error — but this was the deterministic build-script failure that would hit Vercel first on the latest pass.)
… mobile-hint Rebased onto main's Next.js 16.3 Cache Components migration (#3433). Two follow-ups so the dual-version build still works: - `'use cache'` + cacheLife (in copyrightYear.ts and sitemap.ts's getLastModified) is a Cache Components / dynamicIO feature enabled by `cacheComponents: true`. The canary build is a static export (output:'export') which cannot enable cacheComponents, so `'use cache'` is invalid there — and copyrightYear is imported by every layout, so it would break the whole export. Select a plain (uncached) implementation when DOCSITE_TARGET=canary; the latest (server) build keeps the cached variant. Same values, only the caching directive differs. sitemap also gets a canary-gated `dynamic='force-static'` so it still emits as a file under export while latest keeps 'use cache'. - serverMobileHint.ts is now dead code: main's migration removed the server-side UA mobile hint from the layouts (DocsShell/PlaygroundClient no longer take defaultIsMobile), so our export-safe wrapper has no consumers. Removed. Verified: latest generate → 191 pinned components; canary config carries no cacheComponents/rewrites; tsc has only the 2 pre-existing `cacheLife` import errors that main itself has against [email protected] (main imports the same bare `cacheLife`; its `next build --webpack` resolves it) — zero new errors from this branch.
…for canary export
Three deterministic Next 16 build failures in the canary static-export pass,
found by reproducing the Vercel build locally:
1. Turbopack rejects the `webpack` config key. Next 16 defaults to Turbopack;
build-versioned.mjs ran bare `next build` (unlike package.json's
`next build --webpack`), so it errored before compiling. Both passes now use
`--webpack`, matching the repo's build/dev scripts.
2. `'use cache'` is a COMPILE-TIME directive — its presence in a module errors
under output:'export' (which can't enable cacheComponents), regardless of any
runtime DOCSITE_TARGET branch. So the earlier runtime-conditional in
sitemap.ts/copyrightYear.ts didn't work. Instead, build-versioned.mjs now
physically strips `'use cache'`, `cacheLife()` calls, and the `cacheLife`
import from every source file for the canary pass only (auto-discovered,
restored after — same pattern as the route-handler stash). The source files
are reverted to main-identical (they keep `'use cache'` for the latest
server build, which has cacheComponents on).
3. `export const dynamic` must be a static literal — Next 16's route-config
analyzer rejects a ternary ("Unsupported node type ConditionalExpression").
And a metadata route (sitemap.ts) that dropped `'use cache'` still needs
`dynamic='force-static'` to emit as a file under export. build-versioned.mjs
injects that literal into metadata routes during the canary strip, so the
source stays clean (no dynamic export, matching main) and only the canary
build gets it.
Verified locally: canary export now compiles, clears route collection, and
prerenders all 272 pages to out/ with basePath /canary baked in (EXIT 0);
source files restored + routes restored afterward. sitemap.ts and
copyrightYear.ts are now byte-identical to main.
…omponents The latest (server) build runs cacheComponents:true, and Next 16 rejects ANY `export const dynamic` route-segment config under Cache Components — not just the ternary form. robots.ts still carried a hardcoded `export const dynamic = 'force-static'` (the mirror of the sitemap.ts fix, but missed), so the latest build failed to compile: Route segment config "dynamic" is not compatible with nextConfig.cacheComponents Revert robots.ts to byte-identical-to-main (no dynamic export), and move the canary-only force-static injection into build-versioned.mjs so it covers BOTH metadata routes (sitemap.ts + robots.ts) regardless of whether they use `'use cache'` — robots.ts has no `'use cache'`, so it wasn't being processed by the use-cache strip pass. applyCanarySourceTransforms() now unions the use-cache files with the metadata routes, strips + injects as needed, and restores originals after the canary export. Verified locally (both passes, EXIT 0): canary export prerenders 272 pages to out/ with /canary basePath; latest server build compiles past the former robots error and prerenders 277 pages. Source files (robots.ts, sitemap.ts, copyrightYear.ts) are all byte-identical to main; all canary-specific transforms live in build-versioned.mjs.
Replace the top-nav version-switcher dropdown with a low-key footer link to the sibling content line (canary from latest, or back). The canary banner still carries the prominent link back to the stable release.
Add a Versioned Content section to the docsite README explaining that the default deployed site documents the last published release, so library changes merged to main only appear on the canary site until the next release.
686e75a to
81306e1
Compare
Move the canary notice out of SharedTopNav and into AppShell's dedicated banner slot at each shell site, gating the slot on CURRENT_TARGET so latest renders no empty banner wrapper. CURRENT_TARGET comes from the server-safe docsVersions module and the guard is inlined at each call site, so the banner element is passed from Server Components without calling any function exported from the 'use client' CanaryBanner module (which would break the production build).
81306e1 to
1b96c74
Compare
cixzhang
left a comment
There was a problem hiding this comment.
There were significant changes to the way these pages work post cache components PR that weren't properly taken in when we rebased. I might suggest recreating the build-versioned pipeline and root resolution plus the canary banner and footer links on top of latest main. There shouldn't be this many site updates from adding this.
|
Reconstructed the versioning pipeline + canary banner + footer version links cleanly on top of latest main as |
|
Superseded by #3858. That PR takes a much simpler approach based on review feedback here: instead of mounting canary as a nested static export inside one deployment (
The target is derived from |
Problem
The docsite is deployed from
mainon every push. Its build-time data pipeline reads component docs, props, package versions, and templates straight from the working tree — so the published site always documents work in progress. Components and props that only exist onmainshow up in the docs even thoughnpm installdoesn't have them yet. A reader copies an install command, and the thing they just read about isn't in the package.At time of writing
mainis ~117 commits past the last published release, and several components already visible on the live docsite (VisuallyHidden,useKeyboardHint,useTreeFocus) don't exist in any published version.Approach — one codebase, one deployment, two content lines
The docsite code is always current; only the package sources the pipeline reads content from are pinned per target.
latest— documents the last published release (whatnpm installgives you today). The canonical, default site.canary— documentsmain(unreleased, WIP).DOCSITE_TARGET=latest|canaryselects the target at build time.scripts/resolve-content-root.mjsmaps the target to a filesystem content root: canary reads the live workspace; latest materializes the pinned release's sources (from the published tarballs'src/, or deterministically from the release git tag offline).versions.jsonis the single pin. Every generated registry keeps its exact shape, so none of the ~100 files that consume the registries change.One deployment serves both
A single Vercel deployment serves both content lines:
//mcproute + request-time features)/canary/*output:'export',basePath:'/canary'), nested into the latest build'spublic/canary/**so the same deployment's CDN serves itscripts/build-versioned.mjsorchestrates: build canary as a static export (temporarily setting aside the dynamic MCP route, which can't be statically exported — latest still ships it) → copyout/intopublic/canary/→ build latest.vercel.json'sbuildCommandcallsbuild:versioned. No second Vercel project, no second domain, no env config required.To keep the canary pass statically exportable, the SSR-only mobile hint (which read request headers via
next/headers) moves behindgetDefaultIsMobile()(lib/serverMobileHint.ts): it reads the UA in the server build and returns a static default in the export build, where the shell corrects the real state on mount viamatchMedia.UI
/and/canaryon the same origin (no config), correctly normalizing the base path when navigating between targets. AbsoluteNEXT_PUBLIC_DOCS_*URLs are still supported if you'd rather split the targets across two domains.Scope (this PR is a POC / draft)
/canarystatic-mount approach above).Verification
DOCSITE_TARGET=latestpipeline run → registry with the pinned release's component set (216);canary→ the fullmainset (219). The delta is exactly the components added since the release tag (VisuallyHidden,useKeyboardHint,useTreeFocus) — present in canary, absent in latest. This is the WIP-vs-shipped gap the PR closes.pnpm generatesucceeds for both targets (theme build + all registries + playground scope).next.config.mjsresolves correctly per target: canary →output:'export'+basePath:'/canary'+trailingSlash+ unoptimized images; latest → plain server build./canarywhen returning to latest) and trailing-slash variants.DropdownMenu hasAutoFocusshowcase-vs-core prop mismatch that exists onmainindependent of this PR.)Not yet verified in-sandbox
The full
next build(server + static export of 200+ StyleX pages) could not be run to completion in the constrained sandbox — it OOMs during compile/prerender at 4.2 GB RAM. It compiles successfully; only the memory-hungry prerender phase gets killed. CI/Vercel run with more memory. This should be validated on a Vercel preview deploy before the PR is marked ready.Open questions for reviewers
/canarystatic-mount (this PR) vs. two deployments/subdomains? The switcher supports either.latest(recommended) withcanaryat/canary?