MCPcopy Create free account
hub / github.com/cn-docs/vueuse / updateFunctionREADME

Function updateFunctionREADME

scripts/utils.ts:199–223  ·  view source on GitHub ↗
(indexes: PackageIndexes)

Source from the content-addressed store, hash-verified

197}
198
199export async function updateFunctionREADME(indexes: PackageIndexes) {
200 const hasTypes = existsSync(DIR_TYPES)
201
202 if (!hasTypes)
203 console.warn('No types dist found, run `npm run build:types` first.')
204
205 for (const fn of indexes.functions) {
206 const mdPath = `packages/${fn.package}/${fn.name}/index.md`
207 if (!existsSync(mdPath))
208 continue
209
210 let readme = await fs.readFile(mdPath, 'utf-8')
211
212 const { content, data = {} } = matter(readme)
213 const yamlData = yaml.stringify(data, {
214 singleQuote: true,
215 })
216
217 data.category = fn.category || 'Unknown'
218
219 readme = `---\n${yamlData}---\n\n${content.trim()}`.trim().replace(/\r\n/g, '\n')
220
221 await fs.writeFile(mdPath, `${readme}\n`, 'utf-8')
222 }
223}
224
225export async function updateCountBadge(indexes: PackageIndexes) {
226 const functionsCount = indexes.functions.filter(i => !i.internal).length

Callers 1

runFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected