Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: Allow for customisable CLI profiles in ref docs (#40181)

Chris Chinchillad158e7142ae6
diff --git a/apps/docs/components/reference/enrichments/cli/CliGlobalFlagsHandler.tsx b/apps/docs/components/reference/enrichments/cli/CliGlobalFlagsHandler.tsx
index 79787faa2c5..c25dd062c92 100644
--- a/apps/docs/components/reference/enrichments/cli/CliGlobalFlagsHandler.tsx
+++ b/apps/docs/components/reference/enrichments/cli/CliGlobalFlagsHandler.tsx
@@ -2,14 +2,35 @@ import RefSubLayout from '~/layouts/ref/RefSubLayout'
import spec from '~/spec/cli_v1_commands.yaml' with { type: 'yaml' }
import Param from '~/components/Params'
+import { isFeatureEnabled } from 'common'
+import { getCustomContent } from '~/lib/custom-content/getCustomContent'
+
+const { cliDisableCustomProfiles } = isFeatureEnabled(['cli:disable_custom_profiles'])
const CliGlobalFlagsHandler = () => {
+ // Only fetch cliProfile when custom profiles are enabled
+ const cliProfile = !cliDisableCustomProfiles
+ ? getCustomContent(['cli:profile'] as any).cliProfile
+ : undefined
+
+ // Transform the flags based on feature flags
+ const processedFlags = spec.flags.map((flag: any) => {
+ if (flag.id === 'profile' && !cliDisableCustomProfiles) {
+ return {
+ id: 'profile',
+ name: `--profile ${cliProfile}`,
+ description: `use ${cliProfile} profile for connecting to Supabase API`,
+ }
+ }
+ return flag
+ })
+
return (
<RefSubLayout.EducationRow className="not-prose">
<RefSubLayout.Details>
<h3 className="text-lg text-foreground mb-3">Flags</h3>
<ul>
- {spec.flags.map((flag) => {
+ {processedFlags.map((flag) => {
return (
<Param
{...flag}
diff --git a/apps/docs/lib/custom-content/CustomContent.types.ts b/apps/docs/lib/custom-content/CustomContent.types.ts
index 1554064ed77..a936dfac862 100644
--- a/apps/docs/lib/custom-content/CustomContent.types.ts
+++ b/apps/docs/lib/custom-content/CustomContent.types.ts
@@ -2,6 +2,7 @@ export type CustomContentTypes = {
homepageHeading: string
metadataApplicationName: string
metadataTitle: string
+ cliProfile: string
navigationLogo: {
light: string
dark: string
diff --git a/apps/docs/lib/custom-content/getCustomContent.ts b/apps/docs/lib/custom-content/getCustomContent.ts
index 07e327f4fbf..2310114c0f8 100644
--- a/apps/docs/lib/custom-content/getCustomContent.ts
+++ b/apps/docs/lib/custom-content/getCustomContent.ts
@@ -21,9 +21,9 @@ function contentToCamelCase(feature: CustomContent) {
}
type CustomContentResult<T extends CustomContent[]> = {
- [key in CustomContentToCamelCase<T[number]>]:
- | CustomContentTypes[CustomContentToCamelCase<T[number]>]
- | null
+ [key in CustomContentToCamelCase<T[number]> extends keyof CustomContentTypes
+ ? CustomContentToCamelCase<T[number]>
+ : never]: CustomContentTypes[key] | null
}
export const getCustomContent = <T extends CustomContent[]>(
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index 6420164ff23..30a32b68b20 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -29,6 +29,8 @@
"branding:large_logo": false,
+ "cli:disable_custom_profiles": true,
+
"dashboard_auth:sign_up": true,
"dashboard_auth:sign_in_with_github": true,
"dashboard_auth:sign_in_with_sso": true,
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index c742c5a2848..e737c7c36d7 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -99,7 +99,10 @@
"type": "boolean",
"description": "Show larger logo sizes throughout the apps"
},
-
+ "cli:disable_custom_profiles": {
+ "type": "boolean",
+ "description": "Disable custom CLI profiles feature"
+ },
"dashboard_auth:sign_up": {
"type": "boolean",
"description": "Enable the sign up page in the dashboard"