Home / File/ create.ts — ui Source File

create.ts — ui Source File

Architecture documentation for create.ts, a typescript file in the ui codebase. 20 imports, 0 dependents.

File typescript FrameworkTooling TemplateSync 20 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  9461b7e1_0062_183b_052f_41abc70dee91["create.ts"]
  f50d8e38_92d7_c930_5ca6_b71673ceb658["init.ts"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> f50d8e38_92d7_c930_5ca6_b71673ceb658
  56c01a63_5907_6b2d_a507_d935d5ec6f68["runInit"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 56c01a63_5907_6b2d_a507_d935d5ec6f68
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  81c8b1a1_346a_8b27_dd1e_b8bbb29008b8["api"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 81c8b1a1_346a_8b27_dd1e_b8bbb29008b8
  1f2f79fc_356c_e956_002d_737290df27fd["config"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 1f2f79fc_356c_e956_002d_737290df27fd
  2ae56314_aa15_5495_52a2_137787e7b210["constants"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 2ae56314_aa15_5495_52a2_137787e7b210
  ff842930_3a95_1c03_7d51_b342f47a7971["context"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> ff842930_3a95_1c03_7d51_b342f47a7971
  50c29a7b_b93d_0a7c_57d5_beffcb095441["utils"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 50c29a7b_b93d_0a7c_57d5_beffcb095441
  a3b2545e_3d8c_699d_ef11_6ab18db14666["schema"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> a3b2545e_3d8c_699d_ef11_6ab18db14666
  540942ba_3960_0a09_47e1_86b85ff6f2a2["add-components"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 540942ba_3960_0a09_47e1_86b85ff6f2a2
  6be7d8a9_c93c_8743_3ef7_968efff25479["handle-error"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 6be7d8a9_c93c_8743_3ef7_968efff25479
  15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f
  1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1
  a54774e0_4fdd_ca8d_dfff_060d01ad3f57["registries"]
  9461b7e1_0062_183b_052f_41abc70dee91 --> a54774e0_4fdd_ca8d_dfff_060d01ad3f57
  style 9461b7e1_0062_183b_052f_41abc70dee91 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from "path"
import { getPreset, getPresets, getRegistryItems } from "@/src/registry/api"
import { configWithDefaults } from "@/src/registry/config"
import { REGISTRY_URL } from "@/src/registry/constants"
import { clearRegistryContext } from "@/src/registry/context"
import { isUrl } from "@/src/registry/utils"
import { Preset } from "@/src/schema"
import { addComponents } from "@/src/utils/add-components"
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 { updateFiles } from "@/src/utils/updaters/update-files"
import { Command } from "commander"
import dedent from "dedent"
import open from "open"
import prompts from "prompts"
import validateProjectName from "validate-npm-package-name"

import { initOptionsSchema, runInit } from "./init"

const SHADCN_URL = REGISTRY_URL.replace(/\/r\/?$/, "")

const CREATE_TEMPLATES = {
  next: "Next.js",
  vite: "Vite",
  start: "TanStack Start",
} as const

type Template = keyof typeof CREATE_TEMPLATES

export const create = new Command()
  .name("create")
  .description("create a new project with shadcn/ui")
  .argument("[name]", "the name of your project")
  .option(
    "-t, --template <template>",
    "the template to use. e.g. next, start or vite"
  )
  .option("-p, --preset [name]", "use a preset configuration")
  .option(
    "-c, --cwd <cwd>",
    "the working directory. defaults to the current directory.",
    process.cwd()
  )
  .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("-y, --yes", "skip confirmation prompt.", true)
  .option("--rtl", "enable RTL support.", false)
  .action(async (name, opts) => {
    try {
      // If no preset provided, open create URL with template and rtl params.
      const hasNoPreset = !name && !opts.preset
// ... (337 more lines)

Subdomains

Types

Dependencies

  • add-components
  • api
  • commander
  • config
  • constants
  • context
  • dedent
  • handle-error
  • highlighter
  • init.ts
  • logger
  • open
  • path
  • prompts
  • registries
  • runInit
  • schema
  • update-files
  • utils
  • validate-npm-package-name

Frequently Asked Questions

What does create.ts do?
create.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 create.ts?
create.ts defines 6 function(s): buildInitUrl, create, getShadcnCreateUrl, getShadcnInitUrl, getTemplateFiles, handlePresetOption.
What does create.ts depend on?
create.ts imports 20 module(s): add-components, api, commander, config, constants, context, dedent, handle-error, and 12 more.
Where is create.ts in the architecture?
create.ts is located at packages/shadcn/src/commands/create.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