mirror of
https://github.com/supabase/supabase.git
synced 2026-12-05 16:09:06 +00:00
- zod schema for clispec 001/002 and strict sections/spec id check in codegen - CLI versions v3 (latest) and v2 with version switcher keeping the same command - one statically generated page per command under /reference/cli/<path>, overview by category, global flags and migrating-from-v2 pages - breaking-change callouts, flag table with choices and defaults, titled examples with tabular output, collapsible CLI sidebar and single-active TOC - 301 redirects from the old single-page slugs; static redirects point at final paths - Markdown twin per page, CLI llms index and search indexing of the new URLs - crawler script checking links and anchors across every CLI page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.1 KiB
TypeScript
61 lines
2.1 KiB
TypeScript
import { REFERENCES } from '~/content/navigation.references'
|
|
import { ApiReferencePage } from '~/features/docs/Reference.apiPage'
|
|
import { CliReferencePage } from '~/features/docs/Reference.cliPage'
|
|
import { ClientSdkReferencePage } from '~/features/docs/Reference.sdkPage'
|
|
import { SelfHostingReferencePage } from '~/features/docs/Reference.selfHostingPage'
|
|
import {
|
|
generateReferenceMetadata,
|
|
generateReferenceStaticParams,
|
|
parseReferencePath,
|
|
redirectNonexistentReferenceSection,
|
|
} from '~/features/docs/Reference.utils'
|
|
import { notFound } from 'next/navigation'
|
|
|
|
export const dynamicParams = false
|
|
|
|
export default async function ReferencePage(props: { params: Promise<{ slug: Array<string> }> }) {
|
|
const params = await props.params
|
|
|
|
const { slug } = params
|
|
|
|
if (!Object.keys(REFERENCES).includes(slug[0].replaceAll('-', '_'))) {
|
|
notFound()
|
|
}
|
|
|
|
const parsedPath = parseReferencePath(slug)
|
|
const isClientSdkReference = parsedPath.__type === 'clientSdk'
|
|
const isCliReference = parsedPath.__type === 'cli'
|
|
const isApiReference = parsedPath.__type === 'api'
|
|
const isSelfHostingReference = parsedPath.__type === 'self-hosting'
|
|
|
|
if (isClientSdkReference) {
|
|
const { sdkId, maybeVersion, path } = parsedPath
|
|
|
|
const sdkData = REFERENCES[sdkId]
|
|
if (sdkData.enabled === false) {
|
|
notFound()
|
|
}
|
|
|
|
const latestVersion = sdkData.versions[0]
|
|
const version = maybeVersion ?? latestVersion
|
|
|
|
await redirectNonexistentReferenceSection(sdkId, version, path, version === latestVersion)
|
|
|
|
return <ClientSdkReferencePage sdkId={sdkId} libVersion={version} />
|
|
} else if (isCliReference) {
|
|
const version = parsedPath.maybeVersion ?? REFERENCES.cli.versions[0]
|
|
return <CliReferencePage version={version} path={parsedPath.path} />
|
|
} else if (isApiReference) {
|
|
return <ApiReferencePage path={parsedPath.path} />
|
|
} else if (isSelfHostingReference) {
|
|
return (
|
|
<SelfHostingReferencePage service={parsedPath.service} servicePath={parsedPath.servicePath} />
|
|
)
|
|
} else {
|
|
notFound()
|
|
}
|
|
}
|
|
|
|
export const generateStaticParams = generateReferenceStaticParams
|
|
export const generateMetadata = generateReferenceMetadata
|