diff --git a/docs/README.md b/docs/README.md index 8b853b5..3218598 100644 --- a/docs/README.md +++ b/docs/README.md @@ -69,7 +69,13 @@ pnpm run docs:release-check Deploy `docs/out` to `react-structured.dev`. For Vercel, use `docs` as the project root; `vercel.json` checks public dependencies, installs the workspace, and builds -the library before the site. Production installs must not depend on a local yalc store. The +the library before the site. Keep the Framework Preset set to **Next.js** and the +Output Directory override **off** in Vercel's project settings. The Next.js adapter +reads build manifests from `.next` and handles the static export automatically; +setting its Output Directory to `out` makes it look for those manifests in the +wrong folder. `docs/out` remains the exported site for other static hosts. + +Production installs must not depend on a local yalc store. The manual Documentation checks workflow runs the same public-dependency guard and uploads the static site after validation. diff --git a/docs/vercel.json b/docs/vercel.json index e719442..d558ec3 100644 --- a/docs/vercel.json +++ b/docs/vercel.json @@ -1,7 +1,7 @@ { + "framework": "nextjs", "installCommand": "cd .. && node scripts/check-docs-release.mjs && corepack enable && pnpm install --frozen-lockfile --ignore-scripts", "buildCommand": "cd .. && pnpm run docs:build", - "outputDirectory": "out", "cleanUrls": true, "headers": [ { diff --git a/scripts/docs-deployment.test.mjs b/scripts/docs-deployment.test.mjs new file mode 100644 index 0000000..02b80f9 --- /dev/null +++ b/scripts/docs-deployment.test.mjs @@ -0,0 +1,17 @@ +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import test from 'node:test' + +import nextConfig from '../docs/next.config.mjs' + +const vercel = JSON.parse( + readFileSync(new URL('../docs/vercel.json', import.meta.url), 'utf8'), +) + +test('Vercel looks for Next.js build manifests, not static-export assets', () => { + assert.equal(vercel.outputDirectory ?? '.next', nextConfig.distDir ?? '.next') + assert.equal(vercel.framework, 'nextjs') + assert.ok(!Object.hasOwn(vercel, 'outputDirectory')) + assert.equal(nextConfig.output, 'export') + assert.equal(vercel.buildCommand, 'cd .. && pnpm run docs:build') +}) diff --git a/scripts/docs-tooling.test.mjs b/scripts/docs-tooling.test.mjs index 4f781d8..6f904a6 100644 --- a/scripts/docs-tooling.test.mjs +++ b/scripts/docs-tooling.test.mjs @@ -1,5 +1,6 @@ import './oss-credits.test.mjs' import './docs-dependencies.test.mjs' +import './docs-deployment.test.mjs' import './mobile-layout.test.mjs' import './search-recommendations.test.mjs' import './llms.test.mjs'