/
githubmirror
/
vuetify
Обзор
Документация
Войти
/
githubmirror
/
vuetify
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/api-generator/src/vetur.ts
31 строка
1 KB
Kael
chore: use node 24
15 сен 2025, 11:30
15 сен 2025, 11:30
a4ee80e
Код
Авторство
О чём код?
import fs from 'node:fs' import { kebabCase } from './helpers/text.ts' import type { ComponentData } from './types.ts' export function createVeturApi (componentData: ComponentData[]) { const tags = componentData.reduce((obj, component) => { return { ...obj, [component.fileName]: { attributes: Object.keys(component.props ?? {}).map(name => kebabCase(name)).sort(), description: '', }, } }, {}) const attributes = componentData.reduce((obj, component) => { const attrs = Object.entries(component.props ?? {}).reduce((curr, [name, prop]) => { curr[`${component.fileName}/${kebabCase(name)}`] = { type: prop.formatted, description: prop.description!.en || '', } return curr }, {} as Record<string, { type: string, description: string }>) Object.assign(obj, attrs) return obj }, {}) fs.writeFileSync('dist/tags.json', JSON.stringify(tags, null, 2)) fs.writeFileSync('dist/attributes.json', JSON.stringify(attributes, null, 2)) }