()
| 545 | } |
| 546 | |
| 547 | const buildAll = async () => { |
| 548 | const items: any[] = [...themeItems] |
| 549 | for (const f of await listFiles(UI_DIR)) items.push(await buildComponentItem(f)) |
| 550 | for (const f of await listFiles(EXAMPLES_DIR)) items.push(await buildExampleItem(f)) |
| 551 | for (const f of (await listFiles(LIB_DIR)).filter((f) => |
| 552 | LIB_ALLOW.includes(path.basename(f, path.extname(f))) |
| 553 | )) { |
| 554 | items.push(await buildLibItem(f)) |
| 555 | } |
| 556 | for (const f of (await listFiles(HOOKS_DIR)).filter((f) => |
| 557 | HOOKS_ALLOW.includes(path.basename(f, path.extname(f))) |
| 558 | )) { |
| 559 | items.push(await buildHookItem(f)) |
| 560 | } |
| 561 | |
| 562 | const blockPages: string[] = [] |
| 563 | const stack = [BLOCKS_DIR] |
| 564 | while (stack.length) { |
| 565 | const d = stack.pop()! |
| 566 | if (!(await exists(d))) continue |
| 567 | const entries = await fs.readdir(d, { withFileTypes: true }) |
| 568 | for (const e of entries) { |
| 569 | const full = path.join(d, e.name) |
| 570 | if (e.isDirectory()) stack.push(full) |
| 571 | else if (e.name === 'page.tsx') blockPages.push(full) |
| 572 | } |
| 573 | } |
| 574 | for (const p of blockPages) items.push(await buildBlockItem(p)) |
| 575 | items.push(buildAllItems(items)) |
| 576 | const rawRegistry = { |
| 577 | name: REGISTRY_NAME, |
| 578 | homepage: REGISTRY_HOMEPAGE, |
| 579 | items, |
| 580 | } |
| 581 | const registry = registrySchema.parse({ |
| 582 | $schema: 'https://ui.shadcn.com/schema/registry.json', |
| 583 | ...rawRegistry, |
| 584 | }) |
| 585 | const outPath = path.resolve(ROOT, 'registry.json') |
| 586 | await fs.writeFile(outPath, JSON.stringify(registry, null, 2), 'utf8') |
| 587 | } |
| 588 | |
| 589 | buildAll() |
no test coverage detected