MCPcopy
hub / github.com/intentui/intentui / buildHookItem

Function buildHookItem

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

Source from the content-addressed store, hash-verified

410}
411
412const buildHookItem = async (absPath: string) => {
413 const name = path.basename(absPath, path.extname(absPath))
414 const code = await read(absPath)
415 const specs = importSpecifiers(code)
416 const deps = topLevelPackages(specs)
417 const regDeps = await findInternalDepsForFile(absPath, specs)
418 const files: FileOut[] = [await fileEntryOther(absPath, 'registry:hook')]
419 const raw = {
420 $schema: 'https://ui.shadcn.com/schema/registry-item.json',
421 extends: 'none',
422 name,
423 type: 'registry:hook',
424 title: name,
425 description: name,
426 dependencies: deps.length ? deps : undefined,
427 registryDependencies: regDeps.length ? regDeps : undefined,
428 files,
429 }
430 return registryItemSchema.parse(raw)
431}
432
433const buildExampleItem = async (file: string) => {
434 const slug = exampleSlugFromFile(file)

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