Home / Function/ validateFilesTarget() — ui Function Reference

validateFilesTarget() — ui Function Reference

Architecture documentation for the validateFilesTarget() function in add-components.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  58ead2f7_5adf_4a2b_b233_e9e4c09b8dfa["validateFilesTarget()"]
  05e0e857_0905_dce0_82c9_cfde160573bd["add-components.ts"]
  58ead2f7_5adf_4a2b_b233_e9e4c09b8dfa -->|defined in| 05e0e857_0905_dce0_82c9_cfde160573bd
  fdd9197d_b14e_a97e_a1a7_e1ef82de0896["addProjectComponents()"]
  fdd9197d_b14e_a97e_a1a7_e1ef82de0896 -->|calls| 58ead2f7_5adf_4a2b_b233_e9e4c09b8dfa
  c7860b80_e410_7cb2_d73d_5220d24c63d9["addWorkspaceComponents()"]
  c7860b80_e410_7cb2_d73d_5220d24c63d9 -->|calls| 58ead2f7_5adf_4a2b_b233_e9e4c09b8dfa
  style 58ead2f7_5adf_4a2b_b233_e9e4c09b8dfa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/add-components.ts lines 395–410

function validateFilesTarget(
  files: z.infer<typeof registryItemFileSchema>[],
  cwd: string
) {
  for (const file of files) {
    if (!file?.target) {
      continue
    }

    if (!isSafeTarget(file.target, cwd)) {
      throw new Error(
        `We found an unsafe file path "${file.target} in the registry item. Installation aborted.`
      )
    }
  }
}

Subdomains

Frequently Asked Questions

What does validateFilesTarget() do?
validateFilesTarget() is a function in the ui codebase, defined in packages/shadcn/src/utils/add-components.ts.
Where is validateFilesTarget() defined?
validateFilesTarget() is defined in packages/shadcn/src/utils/add-components.ts at line 395.
What calls validateFilesTarget()?
validateFilesTarget() is called by 2 function(s): addProjectComponents, addWorkspaceComponents.

Analyze Your Own Codebase

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

Try Supermodel Free