mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
docs: Only build reference docs if feature is enabled (#47273)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
f34aa108d5
commit
bce47daeea
1 file changed
+15
-2
@@ -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()
|
||||
Reference in new issue
Block a user