From e01699cce50dc350d3e346e1c79ae859d9249f9e Mon Sep 17 00:00:00 2001 From: Chris Chinchilla Date: Thu, 25 Sep 2025 16:26:46 +0200 Subject: [PATCH] docs: Further toggles for Nimbus project (#39010) chore: feature flag footer and fdw section Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com> --- .../extensions/wrappers/[[...slug]]/page.tsx | 25 +++++++++++++------ .../NavigationMenu.constants.ts | 6 ++++- apps/docs/layouts/MainSkeleton.tsx | 13 ++++++---- .../enabled-features/enabled-features.json | 2 ++ .../enabled-features.schema.json | 10 ++++++++ 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx b/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx index d695b03374..239763225b 100644 --- a/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx +++ b/apps/docs/app/guides/database/extensions/wrappers/[[...slug]]/page.tsx @@ -1,28 +1,30 @@ import matter from 'gray-matter' +import Link from 'next/link' +import { notFound } from 'next/navigation' import { readFile } from 'node:fs/promises' import { join, relative } from 'node:path' import rehypeSlug from 'rehype-slug' import emoji from 'remark-emoji' -import Link from 'next/link' +// End of third-party imports + +import { IS_PROD, isFeatureEnabled } from 'common' import { Button } from 'ui' import { Admonition } from 'ui-patterns' - -import { Guide, GuideArticle, GuideHeader, GuideFooter, GuideMdxContent } from '~/features/ui/guide' -import { newEditLink } from '~/features/helpers.edit-link' import { genGuideMeta, genGuidesStaticParams, removeRedundantH1, } from '~/features/docs/GuidesMdx.utils' +import { newEditLink } from '~/features/helpers.edit-link' import { REVALIDATION_TAGS } from '~/features/helpers.fetch' +import { Guide, GuideArticle, GuideFooter, GuideHeader, GuideMdxContent } from '~/features/ui/guide' import { GUIDES_DIRECTORY, isValidGuideFrontmatter } from '~/lib/docs' -import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform' +import { linkTransform, type UrlTransformFunction } from '~/lib/mdx/plugins/rehypeLinkTransform' import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition' import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle' import remarkPyMdownTabs from '~/lib/mdx/plugins/remarkTabs' import { octokit } from '~/lib/octokit' -import { SerializeOptions } from '~/types/next-mdx-remote-serialize' -import { IS_PROD } from 'common' +import type { SerializeOptions } from '~/types/next-mdx-remote-serialize' // We fetch these docs at build time from an external repo const org = 'supabase' @@ -85,7 +87,10 @@ async function getLatestRelease(after: string | null = null) { after, request: { fetch: (url: RequestInfo | URL, options?: RequestInit) => - fetch(url, { ...options, next: { tags: [REVALIDATION_TAGS.WRAPPERS] } }), + fetch(url, { + ...options, + next: { tags: [REVALIDATION_TAGS.WRAPPERS] }, + }), }, }) @@ -243,6 +248,10 @@ interface Params { } const WrappersDocs = async (props: { params: Promise }) => { + if (!isFeatureEnabled('docs:fdw')) { + notFound() + } + const params = await props.params const { isExternal, meta, assetsBaseUrl, ...data } = await getContent(params) diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts index 2612788b20..74a142f1bd 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts @@ -1,4 +1,5 @@ import type { ComponentProps } from 'react' +// End of third-party imports import { isFeatureEnabled } from 'common/enabled-features' import type { IconPanel } from 'ui-patterns/IconPanel' @@ -14,13 +15,14 @@ const { docsAuthTroubleshooting: authTroubleshootingEnabled, docsCompliance: complianceEnabled, docsContribution: contributionEnabled, - 'docsSelf-hosting': selfHostingEnabled, + docsFdw: fdwEnabled, docsFrameworkQuickstarts: frameworkQuickstartsEnabled, docsFullPlatform: fullPlatformEnabled, docsLocalDevelopment: localDevelopmentEnabled, docsMobileTutorials: mobileTutorialsEnabled, docsPgtap: pgTapEnabled, docsProductionChecklist: productionChecklistEnabled, + 'docsSelf-hosting': selfHostingEnabled, docsWebApps: webAppsEnabled, integrationsPartners: integrationsEnabled, sdkCsharp: sdkCsharpEnabled, @@ -38,6 +40,7 @@ const { 'docs:auth_troubleshooting', 'docs:compliance', 'docs:contribution', + 'docs:fdw', 'docs:self-hosting', 'docs:framework_quickstarts', 'docs:full_platform', @@ -1260,6 +1263,7 @@ export const database: NavMenuConstant = { { name: 'Foreign Data Wrappers', url: undefined, + enabled: fdwEnabled, items: [ { name: 'Overview', diff --git a/apps/docs/layouts/MainSkeleton.tsx b/apps/docs/layouts/MainSkeleton.tsx index a90c0d3dec..a2f0bf178e 100644 --- a/apps/docs/layouts/MainSkeleton.tsx +++ b/apps/docs/layouts/MainSkeleton.tsx @@ -2,13 +2,14 @@ import dynamic from 'next/dynamic' import { usePathname } from 'next/navigation' -import { memo, useEffect, type PropsWithChildren, type ReactNode } from 'react' +import { memo, type PropsWithChildren, type ReactNode, useEffect } from 'react' +// End of third-party imports +import { isFeatureEnabled } from 'common' import { cn } from 'ui' - -import { type NavMenuSection } from '~/components/Navigation/Navigation.types' +import type { NavMenuSection } from '~/components/Navigation/Navigation.types' import DefaultNavigationMenu, { - MenuId, + type MenuId, } from '~/components/Navigation/NavigationMenu/NavigationMenu' import { getMenuId } from '~/components/Navigation/NavigationMenu/NavigationMenu.utils' import TopNavBar from '~/components/Navigation/NavigationMenu/TopNavBar' @@ -17,6 +18,8 @@ import { menuState, useMenuMobileOpen } from '~/hooks/useMenuState' const Footer = dynamic(() => import('~/components/Navigation/Footer')) +const footerEnabled = isFeatureEnabled('docs:footer') + const levelsData = { home: { icon: 'home', @@ -375,7 +378,7 @@ function SidebarSkeleton({ menuId: _menuId, menuName, NavigationMenu, - hideFooter = false, + hideFooter = !footerEnabled, className, hideSideNav, additionalNavItems, diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json index 1d81d0c5b8..996dc0790a 100644 --- a/packages/common/enabled-features/enabled-features.json +++ b/packages/common/enabled-features/enabled-features.json @@ -40,6 +40,8 @@ "docs:auth_troubleshooting": true, "docs:compliance": true, "docs:contribution": true, + "docs:fdw": true, + "docs:footer": true, "docs:self-hosting": true, "docs:framework_quickstarts": true, "docs:full_getting_started": true, diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json index 831a3e9e04..21a69510b5 100644 --- a/packages/common/enabled-features/enabled-features.schema.json +++ b/packages/common/enabled-features/enabled-features.schema.json @@ -144,6 +144,14 @@ "type": "boolean", "description": "Enable documentation on contribution" }, + "docs:fdw": { + "type": "boolean", + "description": "Enable documentation on foreign data wrappers" + }, + "docs:footer": { + "type": "boolean", + "description": "Enable footer on docs site" + }, "docs:framework_quickstarts": { "type": "boolean", "description": "Enable framework quickstarts documentation" @@ -373,6 +381,8 @@ "docs:auth_troubleshooting", "docs:compliance", "docs:contribution", + "docs:fdw", + "docs:footer", "docs:framework_quickstarts", "docs:full_getting_started", "docs:full_platform",