mirror of
https://github.com/supabase/supabase.git
synced 2026-06-03 11:23:41 +08:00
fix(docs): troubleshooting sync script (#31181)
Forgot to change function argument when I changed the `getArticleSlug` signature. Added `ts-check` annotations so TypeScript will catch these errors in the future.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user