MCPcopy
hub / github.com/intentui/intentui / buildComponentItem

Function buildComponentItem

src/scripts/generate-registry.ts:370–389  ·  view source on GitHub ↗
(absPath: string)

Source from the content-addressed store, hash-verified

368}
369
370const buildComponentItem = async (absPath: string) => {
371 const name = path.basename(absPath, path.extname(absPath))
372 const code = await read(absPath)
373 const specs = importSpecifiers(code)
374 const deps = topLevelPackages(specs)
375 const regDeps = await findInternalDepsForFile(absPath, specs)
376 const files: FileOut[] = [await fileEntryOther(absPath, 'registry:ui')]
377 const raw = {
378 $schema: 'https://ui.shadcn.com/schema/registry-item.json',
379 extends: 'none',
380 name,
381 type: 'registry:ui',
382 title: name,
383 description: name,
384 dependencies: deps.length ? deps : undefined,
385 registryDependencies: regDeps.length ? regDeps : undefined,
386 files,
387 }
388 return registryItemSchema.parse(raw)
389}
390
391const buildLibItem = async (absPath: string) => {
392 const name = path.basename(absPath, path.extname(absPath))

Callers 1

buildAllFunction · 0.85

Calls 5

readFunction · 0.85
importSpecifiersFunction · 0.85
topLevelPackagesFunction · 0.85
findInternalDepsForFileFunction · 0.85
fileEntryOtherFunction · 0.85

Tested by

no test coverage detected