Skip to content

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

chore: Handle RegionsList component for md output (#47133)

Jeremias Menichelli469d2e8e5f51
diff --git a/apps/docs/internals/generate-guides-markdown.ts b/apps/docs/internals/generate-guides-markdown.ts
index e692ae1102b..4e54f643f90 100644
--- a/apps/docs/internals/generate-guides-markdown.ts
+++ b/apps/docs/internals/generate-guides-markdown.ts
@@ -18,6 +18,7 @@ import { Link } from './markdown-schema/Link'
import { MetricsStackCards } from './markdown-schema/MetricsStackCards'
import { Panel } from './markdown-schema/Panel'
import { Price } from './markdown-schema/Price'
+import { RegionsList, SmartRegionsList } from './markdown-schema/RegionsList'
import { SharedData } from './markdown-schema/SharedData'
import { StepHike } from './markdown-schema/StepHike'
import { TabPanel } from './markdown-schema/TabPanel'
@@ -139,6 +140,8 @@ const SCHEMA: ComponentSchema = {
Price,
GlassPanel: Panel,
IconPanel: Panel,
+ RegionsList,
+ SmartRegionsList,
...StepHike,
TabPanel,
MetricsStackCards,
diff --git a/apps/docs/internals/markdown-schema/RegionsList.ts b/apps/docs/internals/markdown-schema/RegionsList.ts
new file mode 100644
index 00000000000..3ff0496c965
--- /dev/null
+++ b/apps/docs/internals/markdown-schema/RegionsList.ts
@@ -0,0 +1,22 @@
+import { createRequire } from 'node:module'
+
+// tsx's ESM loader can't pick up named exports from the `shared-data` package
+// (CJS, no `"type": "module"`). Load via `createRequire` for CJS interop —
+// this file only runs in the build script, never in the Next.js bundle.
+const req = createRequire(import.meta.url)
+const { AWS_REGIONS } = req('shared-data') as {
+ AWS_REGIONS: Record<string, { displayName: string; code: string }>
+}
+const { SMART_REGION_TO_EXACT_REGION_MAP } = req('shared-data/regions') as {
+ SMART_REGION_TO_EXACT_REGION_MAP: Map<string, string>
+}
+
+export const RegionsList = (): string =>
+ Object.values(AWS_REGIONS)
+ .map((r) => `- ${r.displayName}, \`${r.code}\``)
+ .join('\n')
+
+export const SmartRegionsList = (): string =>
+ [...SMART_REGION_TO_EXACT_REGION_MAP.entries()]
+ .map(([smart, exact]) => `- ${smart}, \`${exact}\``)
+ .join('\n')