updateAppIndex() — ui Function Reference
Architecture documentation for the updateAppIndex() function in update-app-index.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD e8d77115_a77b_7039_e785_4c569e7e0e59["updateAppIndex()"] 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60["update-app-index.ts"] e8d77115_a77b_7039_e785_4c569e7e0e59 -->|defined in| 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60 style e8d77115_a77b_7039_e785_4c569e7e0e59 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/utils/update-app-index.ts lines 6–24
export async function updateAppIndex(component: string, config: Config) {
const indexPath = path.join(config.resolvedPaths.cwd, "app/page.tsx")
if (!(await fs.stat(indexPath)).isFile()) {
return
}
const [registryItem] = await getRegistryItems([component], { config })
if (
!registryItem?.meta?.importSpecifier ||
!registryItem?.meta?.moduleSpecifier
) {
return
}
// Overwrite the index file with the new import.
const content = `import { ${registryItem?.meta?.importSpecifier} } from "${registryItem.meta.moduleSpecifier}"\n\nexport default function Page() {\n return <${registryItem?.meta?.importSpecifier} />\n}`
await fs.writeFile(indexPath, content, "utf8")
}
Domain
Subdomains
Source
Frequently Asked Questions
What does updateAppIndex() do?
updateAppIndex() is a function in the ui codebase, defined in packages/shadcn/src/utils/update-app-index.ts.
Where is updateAppIndex() defined?
updateAppIndex() is defined in packages/shadcn/src/utils/update-app-index.ts at line 6.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free