Home / File/ build.ts — ui Source File

build.ts — ui Source File

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

Entity Profile

Dependency Diagram

graph LR
  63e091f6_3c2a_b275_9d68_1537ab7744bf["build.ts"]
  85d52bbd_4b11_bf06_ed3a_d8f77f5fee6d["promises"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 85d52bbd_4b11_bf06_ed3a_d8f77f5fee6d
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  0f4371ef_cec9_f90d_93d5_5721463a1d7a["preflight-registry"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 0f4371ef_cec9_f90d_93d5_5721463a1d7a
  50c29a7b_b93d_0a7c_57d5_beffcb095441["utils"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 50c29a7b_b93d_0a7c_57d5_beffcb095441
  a3b2545e_3d8c_699d_ef11_6ab18db14666["schema"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> a3b2545e_3d8c_699d_ef11_6ab18db14666
  2dce5b77_ae3e_67df_2221_13714429e261["errors"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 2dce5b77_ae3e_67df_2221_13714429e261
  24fd9695_7ceb_b1f6_c84e_e349d5356c12["get-project-info"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 24fd9695_7ceb_b1f6_c84e_e349d5356c12
  6be7d8a9_c93c_8743_3ef7_968efff25479["handle-error"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 6be7d8a9_c93c_8743_3ef7_968efff25479
  15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f
  1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1
  a3e9bc4e_1faf_6261_a1db_396981c7761d["spinner"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> a3e9bc4e_1faf_6261_a1db_396981c7761d
  7d629454_eee6_73fe_2526_919af8d00ef9["commander"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 7d629454_eee6_73fe_2526_919af8d00ef9
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  63e091f6_3c2a_b275_9d68_1537ab7744bf --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  style 63e091f6_3c2a_b275_9d68_1537ab7744bf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as fs from "fs/promises"
import * as path from "path"
import { preFlightRegistryBuild } from "@/src/preflights/preflight-registry"
import { recursivelyResolveFileImports } from "@/src/registry/utils"
import { configSchema, registryItemSchema, registrySchema } from "@/src/schema"
import * as ERRORS from "@/src/utils/errors"
import { ProjectInfo, 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 { spinner } from "@/src/utils/spinner"
import { Command } from "commander"
import { z } from "zod"

export const buildOptionsSchema = z.object({
  cwd: z.string(),
  registryFile: z.string(),
  outputDir: z.string(),
  verbose: z.boolean().optional().default(false),
})

export const build = new Command()
  .name("registry:build")
  .description("builds the registry [EXPERIMENTAL]")
  .argument("[registry]", "path to registry.json file", "./registry.json")
  .option(
    "-o, --output <path>",
    "destination directory for json files",
    "./public/r"
  )
  .option(
    "-c, --cwd <cwd>",
    "the working directory. defaults to the current directory.",
    process.cwd()
  )
  .option("-v, --verbose", "verbose output")
  .action(async (registry: string, opts) => {
    await buildRegistry({
      cwd: path.resolve(opts.cwd),
      registryFile: registry,
      outputDir: opts.output,
      verbose: opts.verbose,
    })
  })

async function buildRegistry(opts: z.infer<typeof buildOptionsSchema>) {
  try {
    const options = buildOptionsSchema.parse(opts)

    const [{ errors, resolvePaths, config }, projectInfo] = await Promise.all([
      preFlightRegistryBuild(options),
      getProjectInfo(options.cwd),
    ])

    if (errors[ERRORS.MISSING_CONFIG] || !config || !projectInfo) {
      logger.error(
        `A ${highlighter.info(
          "components.json"
        )} file is required to build the registry. Run ${highlighter.info(
          "shadcn init"
// ... (160 more lines)

Subdomains

Dependencies

  • commander
  • errors
  • get-project-info
  • handle-error
  • highlighter
  • logger
  • path
  • preflight-registry
  • promises
  • schema
  • spinner
  • utils
  • zod

Frequently Asked Questions

What does build.ts do?
build.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in build.ts?
build.ts defines 3 function(s): build, buildRegistry, resolveRegistryItems.
What does build.ts depend on?
build.ts imports 13 module(s): commander, errors, get-project-info, handle-error, highlighter, logger, path, preflight-registry, and 5 more.
Where is build.ts in the architecture?
build.ts is located at packages/shadcn/src/commands/registry/build.ts (domain: FrameworkTooling, subdomain: SchemaValidation, directory: packages/shadcn/src/commands/registry).

Analyze Your Own Codebase

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

Try Supermodel Free