Home / Function/ getWorkspaceConfig() — ui Function Reference

getWorkspaceConfig() — ui Function Reference

Architecture documentation for the getWorkspaceConfig() function in get-config.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  3e550a61_55f0_0b18_8c86_a41e60ec5926["getWorkspaceConfig()"]
  913f04e7_90de_d0b5_5068_4dacd40de96e["get-config.ts"]
  3e550a61_55f0_0b18_8c86_a41e60ec5926 -->|defined in| 913f04e7_90de_d0b5_5068_4dacd40de96e
  62c91426_9ee6_6a1d_bce0_0b30cec8ee48["isAliasKey()"]
  3e550a61_55f0_0b18_8c86_a41e60ec5926 -->|calls| 62c91426_9ee6_6a1d_bce0_0b30cec8ee48
  25c9631d_53ea_f96a_1e58_7ff09c87a03d["findPackageRoot()"]
  3e550a61_55f0_0b18_8c86_a41e60ec5926 -->|calls| 25c9631d_53ea_f96a_1e58_7ff09c87a03d
  accda39a_0dd0_5dea_eb7b_df6ae4616716["getConfig()"]
  3e550a61_55f0_0b18_8c86_a41e60ec5926 -->|calls| accda39a_0dd0_5dea_eb7b_df6ae4616716
  style 3e550a61_55f0_0b18_8c86_a41e60ec5926 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/get-config.ts lines 142–170

export async function getWorkspaceConfig(config: Config) {
  let resolvedAliases: any = {}

  for (const key of Object.keys(config.aliases)) {
    if (!isAliasKey(key, config)) {
      continue
    }

    const resolvedPath = config.resolvedPaths[key]
    const packageRoot = await findPackageRoot(
      config.resolvedPaths.cwd,
      resolvedPath
    )

    if (!packageRoot) {
      resolvedAliases[key] = config
      continue
    }

    resolvedAliases[key] = await getConfig(packageRoot)
  }

  const result = workspaceConfigSchema.safeParse(resolvedAliases)
  if (!result.success) {
    return null
  }

  return result.data
}

Subdomains

Frequently Asked Questions

What does getWorkspaceConfig() do?
getWorkspaceConfig() is a function in the ui codebase, defined in packages/shadcn/src/utils/get-config.ts.
Where is getWorkspaceConfig() defined?
getWorkspaceConfig() is defined in packages/shadcn/src/utils/get-config.ts at line 142.
What does getWorkspaceConfig() call?
getWorkspaceConfig() calls 3 function(s): findPackageRoot, getConfig, isAliasKey.

Analyze Your Own Codebase

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

Try Supermodel Free