Home / Function/ getRegistriesConfig() — ui Function Reference

getRegistriesConfig() — ui Function Reference

Architecture documentation for the getRegistriesConfig() function in api.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  2e3d22da_d26e_cb85_9f40_944aff363e56["getRegistriesConfig()"]
  c41eed12_c415_48c8_bcf4_9d09d3424a18["api.ts"]
  2e3d22da_d26e_cb85_9f40_944aff363e56 -->|defined in| c41eed12_c415_48c8_bcf4_9d09d3424a18
  style 2e3d22da_d26e_cb85_9f40_944aff363e56 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/registry/api.ts lines 121–160

export async function getRegistriesConfig(
  cwd: string,
  options?: { useCache?: boolean }
) {
  const { useCache = true } = options || {}

  // Clear cache if requested
  if (!useCache) {
    explorer.clearCaches()
  }

  const configResult = await explorer.search(cwd)

  if (!configResult) {
    // Do not throw an error if the config is missing.
    // We still have access to the built-in registries.
    return {
      registries: BUILTIN_REGISTRIES,
    }
  }

  // Parse just the registries field from the config
  const registriesConfig = z
    .object({
      registries: registryConfigSchema.optional(),
    })
    .safeParse(configResult.config)

  if (!registriesConfig.success) {
    throw new ConfigParseError(cwd, registriesConfig.error)
  }

  // Merge built-in registries with user registries
  return {
    registries: {
      ...BUILTIN_REGISTRIES,
      ...(registriesConfig.data.registries || {}),
    },
  }
}

Subdomains

Frequently Asked Questions

What does getRegistriesConfig() do?
getRegistriesConfig() is a function in the ui codebase, defined in packages/shadcn/src/registry/api.ts.
Where is getRegistriesConfig() defined?
getRegistriesConfig() is defined in packages/shadcn/src/registry/api.ts at line 121.

Analyze Your Own Codebase

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

Try Supermodel Free