Home / Function/ getTsConfig() — ui Function Reference

getTsConfig() — ui Function Reference

Architecture documentation for the getTsConfig() function in get-project-info.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  c0d67cd9_40d6_c860_08b6_3faf645eba48["getTsConfig()"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe["get-project-info.ts"]
  c0d67cd9_40d6_c860_08b6_3faf645eba48 -->|defined in| 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe
  style c0d67cd9_40d6_c860_08b6_3faf645eba48 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/get-project-info.ts lines 323–347

export async function getTsConfig(cwd: string) {
  for (const fallback of [
    "tsconfig.json",
    "tsconfig.web.json",
    "tsconfig.app.json",
  ]) {
    const filePath = path.resolve(cwd, fallback)
    if (!(await fs.pathExists(filePath))) {
      continue
    }

    // We can't use fs.readJSON because it doesn't support comments.
    const contents = await fs.readFile(filePath, "utf8")
    const cleanedContents = contents.replace(/\/\*\s*\*\//g, "")
    const result = TS_CONFIG_SCHEMA.safeParse(JSON.parse(cleanedContents))

    if (result.error) {
      continue
    }

    return result.data
  }

  return null
}

Subdomains

Frequently Asked Questions

What does getTsConfig() do?
getTsConfig() is a function in the ui codebase, defined in packages/shadcn/src/utils/get-project-info.ts.
Where is getTsConfig() defined?
getTsConfig() is defined in packages/shadcn/src/utils/get-project-info.ts at line 323.

Analyze Your Own Codebase

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

Try Supermodel Free