Home / File/ diff.ts — ui Source File

diff.ts — ui Source File

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

File typescript FrameworkTooling TemplateSync 12 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  d3456bc0_654c_565f_5730_78cca3c9f4c8["diff.ts"]
  eac8f98f_e40a_7fe8_f505_372c83d20c7a["fs"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> eac8f98f_e40a_7fe8_f505_372c83d20c7a
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  81c8b1a1_346a_8b27_dd1e_b8bbb29008b8["api"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> 81c8b1a1_346a_8b27_dd1e_b8bbb29008b8
  a3b2545e_3d8c_699d_ef11_6ab18db14666["schema"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> a3b2545e_3d8c_699d_ef11_6ab18db14666
  b2895591_2a74_d518_deda_2f26be766dcb["get-config"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> b2895591_2a74_d518_deda_2f26be766dcb
  6be7d8a9_c93c_8743_3ef7_968efff25479["handle-error"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> 6be7d8a9_c93c_8743_3ef7_968efff25479
  15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f
  1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1
  e69863ed_3e2f_ef94_648a_ef0155c386ef["transformers"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> e69863ed_3e2f_ef94_648a_ef0155c386ef
  7d629454_eee6_73fe_2526_919af8d00ef9["commander"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> 7d629454_eee6_73fe_2526_919af8d00ef9
  10c50c33_2400_1a89_b1da_5fb324de259c["diff"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> 10c50c33_2400_1a89_b1da_5fb324de259c
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  d3456bc0_654c_565f_5730_78cca3c9f4c8 --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  style d3456bc0_654c_565f_5730_78cca3c9f4c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { existsSync, promises as fs } from "fs"
import path from "path"
import {
  fetchTree,
  getItemTargetPath,
  getRegistryBaseColor,
  getShadcnRegistryIndex,
} from "@/src/registry/api"
import { registryIndexSchema } from "@/src/schema"
import { Config, getConfig } from "@/src/utils/get-config"
import { handleError } from "@/src/utils/handle-error"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { transform } from "@/src/utils/transformers"
import { Command } from "commander"
import { diffLines, type Change } from "diff"
import { z } from "zod"

const updateOptionsSchema = z.object({
  component: z.string().optional(),
  yes: z.boolean(),
  cwd: z.string(),
  path: z.string().optional(),
})

export const diff = new Command()
  .name("diff")
  .description("check for updates against the registry")
  .argument("[component]", "the component name")
  .option("-y, --yes", "skip confirmation prompt.", false)
  .option(
    "-c, --cwd <cwd>",
    "the working directory. defaults to the current directory.",
    process.cwd()
  )
  .action(async (name, opts) => {
    try {
      const options = updateOptionsSchema.parse({
        component: name,
        ...opts,
      })

      const cwd = path.resolve(options.cwd)

      if (!existsSync(cwd)) {
        logger.error(`The path ${cwd} does not exist. Please try again.`)
        process.exit(1)
      }

      const config = await getConfig(cwd)
      if (!config) {
        logger.warn(
          `Configuration is missing. Please run ${highlighter.success(
            `init`
          )} to create a components.json file.`
        )
        process.exit(1)
      }

      const registryIndex = await getShadcnRegistryIndex()
// ... (157 more lines)

Subdomains

Dependencies

  • api
  • commander
  • diff
  • fs
  • get-config
  • handle-error
  • highlighter
  • logger
  • path
  • schema
  • transformers
  • zod

Frequently Asked Questions

What does diff.ts do?
diff.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 diff.ts?
diff.ts defines 3 function(s): diff, diffComponent, printDiff.
What does diff.ts depend on?
diff.ts imports 12 module(s): api, commander, diff, fs, get-config, handle-error, highlighter, logger, and 4 more.
Where is diff.ts in the architecture?
diff.ts is located at packages/shadcn/src/commands/diff.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