MCPcopy
hub / github.com/intentui/intentui / buildExampleItem

Function buildExampleItem

src/scripts/generate-registry.ts:433–452  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

431}
432
433const buildExampleItem = async (file: string) => {
434 const slug = exampleSlugFromFile(file)
435 const code = await read(file)
436 const specs = importSpecifiers(code)
437 const deps = topLevelPackages(specs)
438 const regDeps = await findInternalDepsForFile(file, specs)
439 const files: FileOut[] = [await fileEntryPage(file, `${PAGE_TARGET_ROOT}/${slug}/page.tsx`)]
440 const raw = {
441 $schema: 'https://ui.shadcn.com/schema/registry-item.json',
442 extends: 'none',
443 name: slug,
444 type: 'registry:page',
445 title: titleCase(slug.replace(/-example$/, '').replace(/-/g, ' ')),
446 description: slug,
447 dependencies: deps.length ? deps : undefined,
448 registryDependencies: regDeps.length ? regDeps : undefined,
449 files,
450 }
451 return registryItemSchema.parse(raw)
452}
453
454const registryDepsForBlock = async (pagePath: string, code: string) => {
455 const privates = await collectBlocks(pagePath, code)

Callers 1

buildAllFunction · 0.85

Calls 6

exampleSlugFromFileFunction · 0.85
readFunction · 0.85
importSpecifiersFunction · 0.85
topLevelPackagesFunction · 0.85
findInternalDepsForFileFunction · 0.85
fileEntryPageFunction · 0.85

Tested by

no test coverage detected