/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
apps/docs/scripts/lib/generateApiContent.ts
24 строки
896 B
Mime Čuvalo
npm: upgrade eslint v8 → v9 (#4757)
23 окт 2024, 17:55
Не верифицирован
23 окт 2024, 17:55
b301aeb
Код
Авторство
О чём код?
import path from 'path' import { Articles, GeneratedContent, InputSection } from '../../types/content-types' import { generateSection } from './generateSection' const { log: nicelog } = console export async function generateApiContent(): Promise<GeneratedContent> { const articles: Articles = {} const CONTENT_DIRECTORY = path.join(process.cwd(), 'content') const sections = require(path.join(CONTENT_DIRECTORY, 'sections.json')) as InputSection[] try { const inputApiSection = sections.find((s) => s.id === 'reference') if (!inputApiSection) throw new Error(`Could not find section with id 'reference'`) const outputApiSection = generateSection(inputApiSection, articles, 999999) // always at the end! const contentComplete = { sections: [outputApiSection], articles } return contentComplete } catch (error) { nicelog(`x Could not generate API content`) throw error } }