Skip to content

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

fix(docs): troubleshooting sync script (#31181)

Charise76eba30a9be
diff --git a/apps/docs/features/docs/Troubleshooting.script.mjs b/apps/docs/features/docs/Troubleshooting.script.mjs
index 932def8cc23..698525aaea3 100644
--- a/apps/docs/features/docs/Troubleshooting.script.mjs
+++ b/apps/docs/features/docs/Troubleshooting.script.mjs
@@ -1,3 +1,5 @@
+// @ts-check
+
/* eslint-disable turbo/no-undeclared-env-vars */
/**
@@ -42,7 +44,7 @@ const REPOSITORY_NAME = 'supabase'
*/
let octokitInstance
/**
- * @type {SupabaseClient<import('../../../../packages/common').Database>}
+ * @type {import('@supabase/supabase-js').SupabaseClient<import('../../../../packages/common').Database>}
*/
let supabaseAdminClient
@@ -64,8 +66,8 @@ function octokit() {
export function supabaseAdmin() {
if (!supabaseAdminClient) {
supabaseAdminClient = createClient(
- process.env.NEXT_PUBLIC_SUPABASE_URL,
- process.env.SUPABASE_SECRET_KEY
+ /** @type {string} */ (process.env.NEXT_PUBLIC_SUPABASE_URL),
+ /** @type {string} */ (process.env.SUPABASE_SECRET_KEY)
)
}
@@ -252,7 +254,7 @@ async function updateChecksumIfNeeded(entry) {
* @param {TroubleshootingEntry} entry
*/
function addCanonicalUrl(entry) {
- const docsUrl = 'https://supabase.com/docs/guides/troubleshooting/' + getArticleSlug(entry.data)
+ const docsUrl = 'https://supabase.com/docs/guides/troubleshooting/' + getArticleSlug(entry)
const content =
`_This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the [original article](${docsUrl})._\n\n` +
entry.contentWithoutJsx
diff --git a/apps/docs/features/docs/Troubleshooting.utils.common.mjs b/apps/docs/features/docs/Troubleshooting.utils.common.mjs
index 5be6cdd0677..12c275a08e0 100644
--- a/apps/docs/features/docs/Troubleshooting.utils.common.mjs
+++ b/apps/docs/features/docs/Troubleshooting.utils.common.mjs
@@ -1,3 +1,5 @@
+// @ts-check
+
/**
* This file is for utils needed in both the Next.js app build and the
* troubleshooting sync script. Because of unsolved problems with imports, the
@@ -98,16 +100,13 @@ export const TroubleshootingSchema = z
})
.strict()
-/*
+/**
* @param {unknown} troubleshootingMetadata
*/
function validateTroubleshootingMetadata(troubleshootingMetadata) {
return TroubleshootingSchema.safeParse(troubleshootingMetadata)
}
-/*
- * @returns {Promise<TroubleshootingEntry[]>}
- */
export async function getAllTroubleshootingEntriesInternal() {
const troubleshootingDirectoryContents = await readdir(TROUBLESHOOTING_DIRECTORY, {
recursive: true,
@@ -172,7 +171,7 @@ export async function getAllTroubleshootingEntriesInternal() {
}
})
- return (await Promise.all(troubleshootingFiles)).filter(Boolean)
+ return (await Promise.all(troubleshootingFiles)).filter((x) => x != null)
}
/**