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

migrate-rtl.ts — ui Source File

Architecture documentation for migrate-rtl.ts, a typescript file in the ui codebase. 9 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  376785b7_9619_0848_64f3_0e7ddbddb913["migrate-rtl.ts"]
  eac8f98f_e40a_7fe8_f505_372c83d20c7a["fs"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> eac8f98f_e40a_7fe8_f505_372c83d20c7a
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  b2895591_2a74_d518_deda_2f26be766dcb["get-config"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> b2895591_2a74_d518_deda_2f26be766dcb
  15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f
  1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1
  a3e9bc4e_1faf_6261_a1db_396981c7761d["spinner"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> a3e9bc4e_1faf_6261_a1db_396981c7761d
  2b36fbd1_ef95_343f_56c5_56b1411a9c9b["transform-rtl"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> 2b36fbd1_ef95_343f_56c5_56b1411a9c9b
  587e4732_d484_82b5_c4de_af2e9f20d031["fast-glob"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> 587e4732_d484_82b5_c4de_af2e9f20d031
  e68f2c02_595f_e9c2_5917_7a8d47bcfc87["prompts"]
  376785b7_9619_0848_64f3_0e7ddbddb913 --> e68f2c02_595f_e9c2_5917_7a8d47bcfc87
  style 376785b7_9619_0848_64f3_0e7ddbddb913 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 { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { spinner } from "@/src/utils/spinner"
import { transformDirection } from "@/src/utils/transformers/transform-rtl"
import fg from "fast-glob"
import prompts from "prompts"

// Files that may need manual RTL adjustments.
const FILES_NEEDING_MANUAL_REVIEW = [
  "sidebar.tsx",
  "pagination.tsx",
  "calendar.tsx",
]

const RTL_DOCS_URL = "https://ui.shadcn.com/docs/rtl#manual-migration-optional"

export async function migrateRtl(
  config: Config,
  options: { yes?: boolean; path?: string } = {}
) {
  // Determine files to migrate.
  let files: string[]
  let basePath: string

  if (options.path) {
    // User provided a path/glob.
    basePath = config.resolvedPaths.cwd
    const isGlob = options.path.includes("*")

    if (isGlob) {
      files = await fg(options.path, {
        cwd: basePath,
        onlyFiles: true,
        ignore: ["**/node_modules/**"],
      })
    } else {
      const fullPath = path.resolve(basePath, options.path)
      const stat = await fs.stat(fullPath).catch(() => null)

      if (!stat) {
        throw new Error(`File not found: ${options.path}`)
      }

      if (stat.isDirectory()) {
        basePath = fullPath
        files = await fg("**/*.{js,ts,jsx,tsx}", {
          cwd: basePath,
          onlyFiles: true,
          ignore: ["**/node_modules/**"],
        })
      } else if (stat.isFile()) {
        files = [options.path]
      } else {
        throw new Error(`Unsupported path type: ${options.path}`)
      }
    }

// ... (100 more lines)

Subdomains

Functions

Dependencies

  • fast-glob
  • fs
  • get-config
  • highlighter
  • logger
  • path
  • prompts
  • spinner
  • transform-rtl

Frequently Asked Questions

What does migrate-rtl.ts do?
migrate-rtl.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-rtl.ts?
migrate-rtl.ts defines 1 function(s): migrateRtl.
What does migrate-rtl.ts depend on?
migrate-rtl.ts imports 9 module(s): fast-glob, fs, get-config, highlighter, logger, path, prompts, spinner, and 1 more.
Where is migrate-rtl.ts in the architecture?
migrate-rtl.ts is located at packages/shadcn/src/migrations/migrate-rtl.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