mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 23:19:23 +08:00
wip <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit # Release Notes * **New Features** * Added a new Learn application offering foundational Supabase courses with interactive documentation * Courses include Architecture, Authentication, Data Fundamentals, Security, Storage, Realtime, and Edge Functions * Chapter tracking and progress indicators for course completions * Responsive sidebar navigation with search/command menu * Theme switching support (light, dark, classic dark modes) * Mobile-friendly course interface <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alan Daniel <stylesshjs@gmail.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { existsSync, readdirSync, statSync } from 'fs'
|
|
import path from 'path'
|
|
|
|
/**
|
|
* Get all internal content file paths recursively
|
|
* Returns a Set of paths like '/foundations/realtime', '/foundations/grafana'
|
|
*/
|
|
export function getInternalContentPaths(): Set<string> {
|
|
const internalDir = path.join(process.cwd(), 'content/internal')
|
|
const paths = new Set<string>()
|
|
|
|
if (!existsSync(internalDir)) {
|
|
return paths
|
|
}
|
|
|
|
function scanDirectory(dir: string, prefix: string = '') {
|
|
const entries = readdirSync(dir)
|
|
|
|
for (const entry of entries) {
|
|
const fullPath = path.join(dir, entry)
|
|
const stat = statSync(fullPath)
|
|
|
|
if (stat.isDirectory()) {
|
|
// Recursively scan subdirectories
|
|
scanDirectory(fullPath, prefix ? `${prefix}/${entry}` : entry)
|
|
} else if (entry.endsWith('.mdx') || entry.endsWith('.md')) {
|
|
// Remove file extension to get the path
|
|
const filename = entry.replace(/\.(mdx|md)$/, '')
|
|
const contentPath = prefix ? `/${prefix}/${filename}` : `/${filename}`
|
|
paths.add(contentPath)
|
|
}
|
|
}
|
|
}
|
|
|
|
scanDirectory(internalDir)
|
|
return paths
|
|
}
|
|
|
|
/**
|
|
* Check if internal content exists for a given href
|
|
*/
|
|
export function hasInternalContent(href: string, internalPaths: Set<string>): boolean {
|
|
return internalPaths.has(href)
|
|
}
|