Home / Function/ findLayoutFile() — ui Function Reference

findLayoutFile() — ui Function Reference

Architecture documentation for the findLayoutFile() function in update-fonts.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  bd2a3bf4_2986_cc71_7a80_e94ccb460bb0["findLayoutFile()"]
  b169f1bf_76c5_e7c9_f493_15fe0f296591["update-fonts.ts"]
  bd2a3bf4_2986_cc71_7a80_e94ccb460bb0 -->|defined in| b169f1bf_76c5_e7c9_f493_15fe0f296591
  fef00f60_5066_884e_a811_e67807ebd0a0["updateNextFonts()"]
  fef00f60_5066_884e_a811_e67807ebd0a0 -->|calls| bd2a3bf4_2986_cc71_7a80_e94ccb460bb0
  style bd2a3bf4_2986_cc71_7a80_e94ccb460bb0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/updaters/update-fonts.ts lines 139–160

async function findLayoutFile(
  config: Config,
  projectInfo: ProjectInfo
): Promise<string | null> {
  const cwd = config.resolvedPaths.cwd
  const isSrcDir = projectInfo.isSrcDir
  const isTsx = projectInfo.isTsx
  const ext = isTsx ? "tsx" : "jsx"

  const possiblePaths = isSrcDir
    ? [`src/app/layout.${ext}`, `app/layout.${ext}`]
    : [`app/layout.${ext}`]

  for (const relativePath of possiblePaths) {
    const fullPath = path.join(cwd, relativePath)
    if (existsSync(fullPath)) {
      return fullPath
    }
  }

  return null
}

Subdomains

Called By

Frequently Asked Questions

What does findLayoutFile() do?
findLayoutFile() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-fonts.ts.
Where is findLayoutFile() defined?
findLayoutFile() is defined in packages/shadcn/src/utils/updaters/update-fonts.ts at line 139.
What calls findLayoutFile()?
findLayoutFile() is called by 1 function(s): updateNextFonts.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free