Home / File/ migrate-radix.ts — ui Source File

migrate-radix.ts — ui Source File

Architecture documentation for migrate-radix.ts, a typescript file in the ui codebase. 10 imports, 1 dependents.

File typescript FrameworkTooling TemplateSync 10 imports 1 dependents 4 functions

Entity Profile

Dependency Diagram

graph LR
  f076b937_a1ba_1850_79d6_842fd49f9d02["migrate-radix.ts"]
  eac8f98f_e40a_7fe8_f505_372c83d20c7a["fs"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> eac8f98f_e40a_7fe8_f505_372c83d20c7a
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  b2895591_2a74_d518_deda_2f26be766dcb["get-config"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> b2895591_2a74_d518_deda_2f26be766dcb
  52d51853_b453_3159_f5fc_2e8fcdf57c5f["get-package-info"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> 52d51853_b453_3159_f5fc_2e8fcdf57c5f
  15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f
  1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1
  a3e9bc4e_1faf_6261_a1db_396981c7761d["spinner"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> a3e9bc4e_1faf_6261_a1db_396981c7761d
  150af5b9_bedd_16e6_dc1b_1d1618735391["update-dependencies"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> 150af5b9_bedd_16e6_dc1b_1d1618735391
  587e4732_d484_82b5_c4de_af2e9f20d031["fast-glob"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> 587e4732_d484_82b5_c4de_af2e9f20d031
  e68f2c02_595f_e9c2_5917_7a8d47bcfc87["prompts"]
  f076b937_a1ba_1850_79d6_842fd49f9d02 --> e68f2c02_595f_e9c2_5917_7a8d47bcfc87
  ddbc9ff1_3021_2e8c_b0b6_87999f3567f1["migrate-radix.test.ts"]
  ddbc9ff1_3021_2e8c_b0b6_87999f3567f1 --> f076b937_a1ba_1850_79d6_842fd49f9d02
  style f076b937_a1ba_1850_79d6_842fd49f9d02 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { promises as fs } from "fs"
import path from "path"
import { Config } from "@/src/utils/get-config"
import { getPackageInfo } from "@/src/utils/get-package-info"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { spinner } from "@/src/utils/spinner"
import { updateDependencies } from "@/src/utils/updaters/update-dependencies"
import fg from "fast-glob"
import prompts from "prompts"

function toPascalCase(str: string): string {
  return str
    .split("-")
    .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
    .join("")
}

function processNamedImports(
  namedImports: string,
  isTypeOnly: boolean,
  imports: Array<{ name: string; alias?: string; isType?: boolean }>,
  packageName: string
) {
  // Clean up multi-line imports.
  // Remove comments and whitespace.
  const cleanedImports = namedImports
    .replace(/\/\/.*$/gm, "")
    .replace(/\/\*[\s\S]*?\*\//g, "")
    .replace(/\s+/g, " ")
    .trim()

  const namedImportList = cleanedImports
    .split(",")
    .map((importItem) => importItem.trim())
    .filter(Boolean)

  for (const importItem of namedImportList) {
    const inlineTypeMatch = importItem.match(/^type\s+(\w+)(?:\s+as\s+(\w+))?$/)
    const aliasMatch = importItem.match(/^(\w+)\s+as\s+(\w+)$/)

    if (inlineTypeMatch) {
      // Inline type: "type DialogProps" or "type DialogProps as Props"
      const importName = inlineTypeMatch[1]
      const importAlias = inlineTypeMatch[2]

      if (packageName === "slot" && importName === "Slot" && !importAlias) {
        imports.push({
          name: "Slot",
          alias: "SlotPrimitive",
          isType: true,
        })
      } else {
        imports.push({
          name: importName,
          alias: importAlias,
          isType: true,
        })
      }
    } else if (aliasMatch) {
// ... (396 more lines)

Subdomains

Dependencies

  • fast-glob
  • fs
  • get-config
  • get-package-info
  • highlighter
  • logger
  • path
  • prompts
  • spinner
  • update-dependencies

Frequently Asked Questions

What does migrate-radix.ts do?
migrate-radix.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 migrate-radix.ts?
migrate-radix.ts defines 4 function(s): migrateRadix, migrateRadixFile, processNamedImports, toPascalCase.
What does migrate-radix.ts depend on?
migrate-radix.ts imports 10 module(s): fast-glob, fs, get-config, get-package-info, highlighter, logger, path, prompts, and 2 more.
What files import migrate-radix.ts?
migrate-radix.ts is imported by 1 file(s): migrate-radix.test.ts.
Where is migrate-radix.ts in the architecture?
migrate-radix.ts is located at packages/shadcn/src/migrations/migrate-radix.ts (domain: FrameworkTooling, subdomain: TemplateSync, directory: packages/shadcn/src/migrations).

Analyze Your Own Codebase

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

Try Supermodel Free