From bce47daeea58d4bbdc26c23bb14ed5ed49504692 Mon Sep 17 00:00:00 2001 From: Chris Chinchilla Date: Thu, 25 Jun 2026 13:16:38 +0200 Subject: [PATCH] docs: Only build reference docs if feature is enabled (#47273) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## Summary by CodeRabbit * **Documentation** * Reference documentation generation now only includes feature-enabled SDK pages, so published docs better match what’s available. * Legacy SDK reference pages are now shown selectively based on enabled feature flags. --- .../internals/generate-reference-markdown.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/docs/internals/generate-reference-markdown.ts b/apps/docs/internals/generate-reference-markdown.ts index 7c751d07cf3..b5470a73325 100644 --- a/apps/docs/internals/generate-reference-markdown.ts +++ b/apps/docs/internals/generate-reference-markdown.ts @@ -1,5 +1,6 @@ import fs from 'node:fs/promises' import path from 'node:path' +import { isFeatureEnabled, type Feature } from 'common/enabled-features' import matter from 'gray-matter' import yaml from 'js-yaml' import { fromMarkdown } from 'mdast-util-from-markdown' @@ -41,6 +42,11 @@ type RefBase = { outFile: string /** Folder under docs/ref/ that holds .mdx sections for `type: "markdown"` entries. */ mdxDir: string + /** + * Enabled-features flag gating this reference. When set and the feature is + * disabled in enabled-features.json, the file is not generated. + */ + feature?: Feature } type SdkLegacyRef = RefBase & { @@ -99,6 +105,7 @@ const REFERENCES: Ref[] = [ mdxDir: path.join(MDX_ROOT, 'dart'), sectionsPath: path.join(GENERATED, 'dart.v2.sections.json'), functionsPath: path.join(GENERATED, 'dart.v2.functions.json'), + feature: 'sdk:dart', }, { kind: 'sdk-legacy', @@ -107,6 +114,7 @@ const REFERENCES: Ref[] = [ mdxDir: path.join(MDX_ROOT, 'kotlin'), sectionsPath: path.join(GENERATED, 'kotlin.v1.sections.json'), functionsPath: path.join(GENERATED, 'kotlin.v1.functions.json'), + feature: 'sdk:kotlin', }, { kind: 'sdk-legacy', @@ -115,6 +123,7 @@ const REFERENCES: Ref[] = [ mdxDir: path.join(MDX_ROOT, 'python'), sectionsPath: path.join(GENERATED, 'python.v2.sections.json'), functionsPath: path.join(GENERATED, 'python.v2.functions.json'), + feature: 'sdk:python', }, { kind: 'sdk-legacy', @@ -123,6 +132,7 @@ const REFERENCES: Ref[] = [ mdxDir: path.join(MDX_ROOT, 'swift'), sectionsPath: path.join(GENERATED, 'swift.v2.sections.json'), functionsPath: path.join(GENERATED, 'swift.v2.functions.json'), + feature: 'sdk:swift', }, { kind: 'sdk-legacy', @@ -131,6 +141,7 @@ const REFERENCES: Ref[] = [ mdxDir: path.join(MDX_ROOT, 'csharp'), sectionsPath: path.join(GENERATED, 'csharp.v0.sections.json'), functionsPath: path.join(GENERATED, 'csharp.v0.functions.json'), + feature: 'sdk:csharp', }, ] @@ -393,8 +404,10 @@ async function generate() { path.join(process.cwd(), 'content/reference/javascript/v2/typeSpec.json') ) + const references = REFERENCES.filter((ref) => !ref.feature || isFeatureEnabled(ref.feature)) + await Promise.all( - REFERENCES.map(async (ref) => { + references.map(async (ref) => { let output: string switch (ref.kind) { case 'sdk-legacy': @@ -424,7 +437,7 @@ async function generate() { }) ) - console.log(`Generated ${REFERENCES.length} markdown files under public/markdown/reference/`) + console.log(`Generated ${references.length} markdown files under public/markdown/reference/`) } generate()