update-app-index.ts — ui Source File
Architecture documentation for update-app-index.ts, a typescript file in the ui codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60["update-app-index.ts"] 85d52bbd_4b11_bf06_ed3a_d8f77f5fee6d["promises"] 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60 --> 85d52bbd_4b11_bf06_ed3a_d8f77f5fee6d d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"] 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5 81c8b1a1_346a_8b27_dd1e_b8bbb29008b8["api"] 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60 --> 81c8b1a1_346a_8b27_dd1e_b8bbb29008b8 b2895591_2a74_d518_deda_2f26be766dcb["get-config"] 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60 --> b2895591_2a74_d518_deda_2f26be766dcb style 5fca5c60_a7e7_46ee_5c3d_b0096ce92f60 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from "fs/promises"
import path from "path"
import { getRegistryItems } from "@/src/registry/api"
import { Config } from "@/src/utils/get-config"
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
Functions
Dependencies
- api
- get-config
- path
- promises
Source
Frequently Asked Questions
What does update-app-index.ts do?
update-app-index.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, TemplateSync subdomain.
What functions are defined in update-app-index.ts?
update-app-index.ts defines 1 function(s): updateAppIndex.
What does update-app-index.ts depend on?
update-app-index.ts imports 4 module(s): api, get-config, path, promises.
Where is update-app-index.ts in the architecture?
update-app-index.ts is located at packages/shadcn/src/utils/update-app-index.ts (domain: FrameworkTooling, subdomain: TemplateSync, directory: packages/shadcn/src/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free