(absPath: string)
| 410 | } |
| 411 | |
| 412 | const 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 | |
| 433 | const buildExampleItem = async (file: string) => { |
| 434 | const slug = exampleSlugFromFile(file) |
no test coverage detected