Home / Function/ updateFonts() — ui Function Reference

updateFonts() — ui Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

packages/shadcn/src/utils/updaters/update-fonts.ts lines 78–113

export async function updateFonts(
  fonts: RegistryFontItem[] | undefined,
  config: Config,
  options: {
    silent?: boolean
  }
) {
  if (!fonts?.length) {
    return
  }

  const projectInfo = await getProjectInfo(config.resolvedPaths.cwd)

  if (!projectInfo) {
    return
  }

  if (
    projectInfo.framework.name !== "next-app" &&
    projectInfo.framework.name !== "next-pages"
  ) {
    return
  }

  const fontsSpinner = spinner("Updating fonts.", {
    silent: options.silent,
  })?.start()

  try {
    await updateNextFonts(fonts, config, projectInfo)
    fontsSpinner?.succeed("Updating fonts.")
  } catch (error) {
    fontsSpinner?.fail(`Failed to update fonts.`)
    throw error
  }
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free