Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced docs validation script #2075

Open
wants to merge 77 commits into
base: main
Choose a base branch
from

Conversation

NWylynko
Copy link
Contributor

@NWylynko NWylynko commented Mar 5, 2025

This is a cut down version of #2041 doing purely the validation aspect. It covers the following things:

Standard docs validation

  • Manifest contains correct format and schema
  • Failure ❌
// Invalid: Missing required 'href' property
{
  "title": "Getting Started",
  "icon": "rocket"
}
  • All guides referenced in manifest exist as files
  • Failure ❌
// Invalid: References a non-existent file
{
  "title": "Payment Processing",
  "href": "/docs/payments" // "/docs/payments.mdx" doesn't exist
}
  • Frontmatter in each markdown file contains required title
  • Failure ❌
// Invalid frontmatter - missing title
---
description: How to get started with our product
---
  • Frontmatter is valid yaml
  • Failure ❌
// Invalid frontmatter - title starts with a backtick
---
title: `useClerk()`
---
  • URLs don't contain characters that need encoding
  • Failure ❌
// Invalid URL with spaces
[User Management](/docs/user management)
  • Links between guides point to existing documents
  • Warning ⚠️
// Invalid link to non-existent document
Learn about [API Rate Limits](/docs/rate-limits) here.
  • Hash fragments (#) in links match actual headings
  • Warning ⚠️
// Invalid: No "configuration" heading exists in the target document
Check the [Configuration Options](/docs/setup#configuration)
  • Files referenced by <Include /> components exist
  • Warning ⚠️
// Invalid: References a non-existent partial
<Include src="_partials/troubleshooting.mdx" />
  • No nested partials (partials inside partials)
  • Failure ❌
// Valid: Simple partial
// In _partials/header.mdx
# Welcome to our docs

// Invalid: Nested partial
// In _partials/page-template.mdx
<Include src="_partials/header.mdx" />
<p>Main content goes here</p>
  • <Include /> src props start with "_partials/"
  • Warning ⚠️
// Invalid: Incorrect path format
<Include src="code-sample.mdx" />

New SDK Validation

  • All SDKs in manifest are valid
  • Failure ❌
// Invalid: Contains unrecognized SDK
{
  "title": "React Integration",
  "href": "/docs/react-integration",
  "sdk": ["rreact"] // 'rreact' is not valid
}
  • SDK values in frontmatter are valid
  • Failure ❌
// Invalid SDK values
---
title: Angular Components
sdk: angular, svelte
---
  • <If /> components reference valid SDKs for the guide
  • Failure ❌
// Invalid: Guide's frontmatter doesn't include "python"
---
sdk: react, nextjs
---
<If sdk="python">
  Use the Python client: `import auth_client`
</If>
  • <If /> components reference SDKs available in manifest
  • Failure ❌
// Invalid: Manifest doesn't include this guide for "ruby"
// Manifest entry: { "sdk": ["javascript-frontend", "react"] }
<If sdk="ruby">
  Use Ruby gems
</If>
  • Core document paths don't conflict with SDK-specific paths
  • Failure ❌
// Invalid - Creates conflict
/docs/react.mdx  // Core document with same name as SDK
/docs/react/index.mdx  // SDK directory structure

…<SignIn /> component regardless of if they have an example
@alexisintech alexisintech requested a review from jescalan March 5, 2025 16:54
package.json Outdated
},
"devDependencies": {
"@sindresorhus/slugify": "^2.2.1",
"@types/node": "^22.13.2",
"chokidar": "^4.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔪

Comment on lines +28 to +50
const VALID_SDKS = [
'nextjs',
'react',
'javascript-frontend',
'chrome-extension',
'expo',
'ios',
'nodejs',
'expressjs',
'fastify',
'react-router',
'remix',
'tanstack-start',
'go',
'astro',
'nuxt',
'vue',
'ruby',
'python',
'javascript-backend',
'sdk-development',
'community-sdk',
] as const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const VALID_SDKS = [
'nextjs',
'react',
'javascript-frontend',
'chrome-extension',
'expo',
'ios',
'nodejs',
'expressjs',
'fastify',
'react-router',
'remix',
'tanstack-start',
'go',
'astro',
'nuxt',
'vue',
'ruby',
'python',
'javascript-backend',
'sdk-development',
'community-sdk',
] as const
const VALID_SDKS = [
'nextjs',
'react',
'js-frontend',
'chrome-extension',
'expo',
'ios',
'nodejs',
'expressjs',
'fastify',
'react-router',
'remix',
'tanstack-start',
'go',
'astro',
'nuxt',
'vue',
'ruby',
'python',
'js-backend',
'sdk-development',
'community-sdk',
] as const

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants