The validate command ensures that committed index files match the expected output. It processes all page.mdx files, extracts metadata, and verifies that parent indexes are up-to-date.
pnpm docs-infra validate [paths...]
| Argument | Type | Description |
|---|---|---|
paths | string[] | Optional paths to validate (e.g., docs-infra/components) |
| Option | Type | Default | Description |
|---|---|---|---|
--command | string | pnpm docs-infra validate | Command to suggest when indexes are out of date |
--useVisibleDescription | boolean | false | Use first visible paragraph as description |
pnpm docs-infra validate
Processes all page.mdx files in src/app/ and app/ directories.
pnpm docs-infra validate docs-infra/components docs-infra/functions
Only validates indexes under the specified paths.
pnpm docs-infra validate --useVisibleDescription
Uses the first visible paragraph in each page as the description, instead of the meta tag.
page.mdx files in the app directoriestransformMarkdownMetadataValidating committed files match expected output...
Processing 47 page.mdx files...
No indexes needed updating
✓ 0 index files updated in 1.23s
Validating committed files match expected output...
Processing 47 page.mdx files...
Updated index files:
app/docs-infra/components/page.mdx
app/docs-infra/functions/page.mdx
Total: 2 indexes updated
✓ 2 index files updated in 1.45s
When running in CI (CI=true) and indexes are out of date:
Updated index files:
app/docs-infra/components/page.mdx
Total: 1 indexes updated
✓ 1 index files updated in 1.23s
✗ Index files are out of date. Run this command locally:
pnpm docs-infra validate docs-infra/components
Then commit the results.
Exit code: 1
The command uses marker files to track which indexes were updated:
.next/cache/docs-infra/index-updates/The validate command uses the transformMarkdownMetadata plugin internally:
const processor = unified()
.use(remarkParse)
.use(remarkMdx)
.use(transformMarkdownMetadata, {
extractToIndex: {
include: includePatterns,
exclude: [],
baseDir: cwd,
onlyUpdateIndexes: true,
markerDir: '.next/cache/docs-infra/index-updates',
useVisibleDescription,
},
});
transformMarkdownMetadata - Remark plugin for metadata extractionsyncPageIndex - Function that performs the actual index updatescreateSitemap - Uses extracted metadata for search