Home / Function/ getRawConfig() — ui Function Reference

getRawConfig() — ui Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  85bede48_57b0_6dfb_357b_3f61f57acdee["getRawConfig()"]
  913f04e7_90de_d0b5_5068_4dacd40de96e["get-config.ts"]
  85bede48_57b0_6dfb_357b_3f61f57acdee -->|defined in| 913f04e7_90de_d0b5_5068_4dacd40de96e
  accda39a_0dd0_5dea_eb7b_df6ae4616716["getConfig()"]
  accda39a_0dd0_5dea_eb7b_df6ae4616716 -->|calls| 85bede48_57b0_6dfb_357b_3f61f57acdee
  style 85bede48_57b0_6dfb_357b_3f61f57acdee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/get-config.ts lines 104–137

export async function getRawConfig(
  cwd: string
): Promise<z.infer<typeof rawConfigSchema> | null> {
  try {
    const configResult = await explorer.search(cwd)

    if (!configResult) {
      return null
    }

    const config = rawConfigSchema.parse(configResult.config)

    // Check if user is trying to override built-in registries
    if (config.registries) {
      for (const registryName of Object.keys(config.registries)) {
        if (registryName in BUILTIN_REGISTRIES) {
          throw new Error(
            `"${registryName}" is a built-in registry and cannot be overridden.`
          )
        }
      }
    }

    return config
  } catch (error) {
    const componentPath = `${cwd}/components.json`
    if (error instanceof Error && error.message.includes("reserved registry")) {
      throw error
    }
    throw new Error(
      `Invalid configuration found in ${highlighter.info(componentPath)}.`
    )
  }
}

Subdomains

Called By

Frequently Asked Questions

What does getRawConfig() do?
getRawConfig() is a function in the ui codebase, defined in packages/shadcn/src/utils/get-config.ts.
Where is getRawConfig() defined?
getRawConfig() is defined in packages/shadcn/src/utils/get-config.ts at line 104.
What calls getRawConfig()?
getRawConfig() is called by 1 function(s): getConfig.

Analyze Your Own Codebase

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

Try Supermodel Free