add.ts — ui Source File
Architecture documentation for add.ts, a typescript file in the ui codebase. 22 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR bcd87158_201e_8041_38a6_f566a96d459f["add.ts"] d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"] bcd87158_201e_8041_38a6_f566a96d459f --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5 48a2db16_690d_8450_b9e9_0bd7642157d3["init"] bcd87158_201e_8041_38a6_f566a96d459f --> 48a2db16_690d_8450_b9e9_0bd7642157d3 455779cd_5f3b_2a27_7aba_ba1e762404a0["preflight-add"] bcd87158_201e_8041_38a6_f566a96d459f --> 455779cd_5f3b_2a27_7aba_ba1e762404a0 81c8b1a1_346a_8b27_dd1e_b8bbb29008b8["api"] bcd87158_201e_8041_38a6_f566a96d459f --> 81c8b1a1_346a_8b27_dd1e_b8bbb29008b8 2ae56314_aa15_5495_52a2_137787e7b210["constants"] bcd87158_201e_8041_38a6_f566a96d459f --> 2ae56314_aa15_5495_52a2_137787e7b210 ff842930_3a95_1c03_7d51_b342f47a7971["context"] bcd87158_201e_8041_38a6_f566a96d459f --> ff842930_3a95_1c03_7d51_b342f47a7971 889ef9cd_bc40_3de2_281d_ca62c5417b57["schema"] bcd87158_201e_8041_38a6_f566a96d459f --> 889ef9cd_bc40_3de2_281d_ca62c5417b57 50c29a7b_b93d_0a7c_57d5_beffcb095441["utils"] bcd87158_201e_8041_38a6_f566a96d459f --> 50c29a7b_b93d_0a7c_57d5_beffcb095441 540942ba_3960_0a09_47e1_86b85ff6f2a2["add-components"] bcd87158_201e_8041_38a6_f566a96d459f --> 540942ba_3960_0a09_47e1_86b85ff6f2a2 f99a5659_f4c9_d2b6_4882_a58bad926b75["create-project"] bcd87158_201e_8041_38a6_f566a96d459f --> f99a5659_f4c9_d2b6_4882_a58bad926b75 b900020d_484b_aaae_1b3f_6d4201875bd9["env-loader"] bcd87158_201e_8041_38a6_f566a96d459f --> b900020d_484b_aaae_1b3f_6d4201875bd9 2dce5b77_ae3e_67df_2221_13714429e261["errors"] bcd87158_201e_8041_38a6_f566a96d459f --> 2dce5b77_ae3e_67df_2221_13714429e261 b2895591_2a74_d518_deda_2f26be766dcb["get-config"] bcd87158_201e_8041_38a6_f566a96d459f --> b2895591_2a74_d518_deda_2f26be766dcb 24fd9695_7ceb_b1f6_c84e_e349d5356c12["get-project-info"] bcd87158_201e_8041_38a6_f566a96d459f --> 24fd9695_7ceb_b1f6_c84e_e349d5356c12 style bcd87158_201e_8041_38a6_f566a96d459f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import path from "path"
import { runInit } from "@/src/commands/init"
import { preFlightAdd } from "@/src/preflights/preflight-add"
import { getRegistryItems, getShadcnRegistryIndex } from "@/src/registry/api"
import { DEPRECATED_COMPONENTS } from "@/src/registry/constants"
import { clearRegistryContext } from "@/src/registry/context"
import { registryItemTypeSchema } from "@/src/registry/schema"
import { isUniversalRegistryItem } from "@/src/registry/utils"
import { addComponents } from "@/src/utils/add-components"
import { createProject } from "@/src/utils/create-project"
import { loadEnvFiles } from "@/src/utils/env-loader"
import * as ERRORS from "@/src/utils/errors"
import { createConfig, getConfig } from "@/src/utils/get-config"
import { getProjectInfo } from "@/src/utils/get-project-info"
import { handleError } from "@/src/utils/handle-error"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { ensureRegistriesInConfig } from "@/src/utils/registries"
import { updateAppIndex } from "@/src/utils/update-app-index"
import { Command } from "commander"
import prompts from "prompts"
import { z } from "zod"
export const addOptionsSchema = z.object({
components: z.array(z.string()).optional(),
yes: z.boolean(),
overwrite: z.boolean(),
cwd: z.string(),
all: z.boolean(),
path: z.string().optional(),
silent: z.boolean(),
srcDir: z.boolean().optional(),
cssVariables: z.boolean(),
})
export const add = new Command()
.name("add")
.description("add a component to your project")
.argument("[components...]", "names, url or local path to component")
.option("-y, --yes", "skip confirmation prompt.", false)
.option("-o, --overwrite", "overwrite existing files.", false)
.option(
"-c, --cwd <cwd>",
"the working directory. defaults to the current directory.",
process.cwd()
)
.option("-a, --all", "add all available components", false)
.option("-p, --path <path>", "the path to add the component to.")
.option("-s, --silent", "mute output.", false)
.option(
"--src-dir",
"use the src directory when creating a new project.",
false
)
.option(
"--no-src-dir",
"do not use the src directory when creating a new project."
)
.option("--css-variables", "use css variables for theming.", true)
.option("--no-css-variables", "do not use css variables for theming.")
// ... (263 more lines)
Domain
Subdomains
Functions
Dependencies
- add-components
- api
- commander
- constants
- context
- create-project
- env-loader
- errors
- get-config
- get-project-info
- handle-error
- highlighter
- init
- logger
- path
- preflight-add
- prompts
- registries
- schema
- update-app-index
- utils
- zod
Source
Frequently Asked Questions
What does add.ts do?
add.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, TemplateSync subdomain.
What functions are defined in add.ts?
add.ts defines 2 function(s): add, promptForRegistryComponents.
What does add.ts depend on?
add.ts imports 22 module(s): add-components, api, commander, constants, context, create-project, env-loader, errors, and 14 more.
Where is add.ts in the architecture?
add.ts is located at packages/shadcn/src/commands/add.ts (domain: FrameworkTooling, subdomain: TemplateSync, directory: packages/shadcn/src/commands).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free