()
| 17 | let cachedAuthors: Record<string, any> | null = null |
| 18 | |
| 19 | async function loadAuthors(): Promise<Record<string, any>> { |
| 20 | if (cachedAuthors) return cachedAuthors |
| 21 | await ensureContentDirs() |
| 22 | const files = await fs.readdir(AUTHORS_DIR).catch(() => []) |
| 23 | const authors: Record<string, any> = {} |
| 24 | for (const file of files) { |
| 25 | if (!file.endsWith('.json')) continue |
| 26 | const raw = await fs.readFile(path.join(AUTHORS_DIR, file), 'utf-8') |
| 27 | const json = JSON.parse(raw) |
| 28 | const author = AuthorSchema.parse(json) |
| 29 | authors[author.id] = author |
| 30 | } |
| 31 | cachedAuthors = authors |
| 32 | return authors |
| 33 | } |
| 34 | |
| 35 | function slugify(text: string): string { |
| 36 | return text |
no test coverage detected