Skip to content

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

fix(kb): render callouts in troubleshooting articles (#52152)

Ali Waseem2aed6c5ea8bc
diff --git a/apps/kb/scripts/federated-content/fetch-federated-content.ts b/apps/kb/scripts/federated-content/fetch-federated-content.ts
index 35bc1db748a..5ac9d4f6383 100644
--- a/apps/kb/scripts/federated-content/fetch-federated-content.ts
+++ b/apps/kb/scripts/federated-content/fetch-federated-content.ts
@@ -4,7 +4,7 @@
// collection). No content processing: body text is written as fetched.
import '../utils/dotenv.js'
-import { mkdir, writeFile } from 'node:fs/promises'
+import { mkdir, rm, writeFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { Octokit } from '@octokit/core'
@@ -89,11 +89,12 @@ async function fetchPage(filename: string): Promise<'fetched' | 'legacy-toml'> {
topics: guide.topics,
}
const output = matter.stringify(guide.body, frontmatter)
- await writeFile(join(TROUBLESHOOTING_DIRECTORY, `${slugFromFilename(filename)}.md`), output)
+ await writeFile(join(TROUBLESHOOTING_DIRECTORY, `${slugFromFilename(filename)}.mdx`), output)
return 'fetched'
}
async function fetchFederatedContent() {
+ await rm(TROUBLESHOOTING_DIRECTORY, { recursive: true, force: true })
await mkdir(TROUBLESHOOTING_DIRECTORY, { recursive: true })
const filenames = await listMarkdownFiles(SOURCE.dir)
diff --git a/apps/kb/scripts/federated-content/sync-troubleshooting-entries.ts b/apps/kb/scripts/federated-content/sync-troubleshooting-entries.ts
index c8f307ce190..d577053c0a9 100644
--- a/apps/kb/scripts/federated-content/sync-troubleshooting-entries.ts
+++ b/apps/kb/scripts/federated-content/sync-troubleshooting-entries.ts
@@ -27,12 +27,12 @@ const RetryOctokit = Octokit.plugin(retry)
const octokit = new RetryOctokit(githubAuthOptions())
async function readLocalGuides(): Promise<Array<{ slug: string; title: string; body: string }>> {
- const filenames = (await readdir(TROUBLESHOOTING_DIRECTORY)).filter((f) => f.endsWith('.md'))
+ const filenames = (await readdir(TROUBLESHOOTING_DIRECTORY)).filter((f) => f.endsWith('.mdx'))
return Promise.all(
filenames.map(async (filename) => {
const raw = await readFile(join(TROUBLESHOOTING_DIRECTORY, filename), 'utf-8')
const { data, content: body } = matter(raw)
- return { slug: filename.replace(/\.md$/, ''), title: data.title as string, body }
+ return { slug: filename.replace(/\.mdx$/, ''), title: data.title as string, body }
})
)
}
diff --git a/apps/kb/scripts/federated-content/sync-troubleshooting-updates.ts b/apps/kb/scripts/federated-content/sync-troubleshooting-updates.ts
index 7230885fa01..acea5586ae9 100644
--- a/apps/kb/scripts/federated-content/sync-troubleshooting-updates.ts
+++ b/apps/kb/scripts/federated-content/sync-troubleshooting-updates.ts
@@ -29,12 +29,12 @@ const RetryOctokit = Octokit.plugin(retry)
const octokit = new RetryOctokit(githubAuthOptions())
async function readLocalGuides(): Promise<Array<{ slug: string; title: string; body: string }>> {
- const filenames = (await readdir(TROUBLESHOOTING_DIRECTORY)).filter((f) => f.endsWith('.md'))
+ const filenames = (await readdir(TROUBLESHOOTING_DIRECTORY)).filter((f) => f.endsWith('.mdx'))
return Promise.all(
filenames.map(async (filename) => {
const raw = await readFile(join(TROUBLESHOOTING_DIRECTORY, filename), 'utf-8')
const { data, content: body } = matter(raw)
- return { slug: filename.replace(/\.md$/, ''), title: data.title as string, body }
+ return { slug: filename.replace(/\.mdx$/, ''), title: data.title as string, body }
})
)
}