migrateRadix() — ui Function Reference
Architecture documentation for the migrateRadix() function in migrate-radix.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD bdc06216_90b8_106e_0b22_5a7237bbb661["migrateRadix()"] f076b937_a1ba_1850_79d6_842fd49f9d02["migrate-radix.ts"] bdc06216_90b8_106e_0b22_5a7237bbb661 -->|defined in| f076b937_a1ba_1850_79d6_842fd49f9d02 e943b775_1b94_05b2_d4e6_b95d2e09ee63["migrateRadixFile()"] bdc06216_90b8_106e_0b22_5a7237bbb661 -->|calls| e943b775_1b94_05b2_d4e6_b95d2e09ee63 style bdc06216_90b8_106e_0b22_5a7237bbb661 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/migrations/migrate-radix.ts lines 101–267
export async function migrateRadix(
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}`)
}
}
if (files.length === 0) {
throw new Error(`No files found matching: ${options.path}`)
}
} else {
// Default: use ui path from components.json.
if (!config.resolvedPaths.ui) {
throw new Error(
"We could not find a valid `ui` path in your `components.json` file. Please ensure you have a valid `ui` path in your `components.json` file."
)
}
basePath = config.resolvedPaths.ui
files = await fg("**/*.{js,ts,jsx,tsx}", {
cwd: basePath,
onlyFiles: true,
})
}
// Confirm with user.
if (!options.yes) {
const relativePath = options.path
? options.path
: `./${path.relative(config.resolvedPaths.cwd, basePath)}`
const { confirm } = await prompts({
type: "confirm",
name: "confirm",
initial: true,
message: `We will migrate ${highlighter.info(
files.length
)} file(s) in ${highlighter.info(relativePath)} to ${highlighter.info(
"radix-ui"
)}. Continue?`,
})
if (!confirm) {
logger.info("Migration cancelled.")
process.exit(0)
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does migrateRadix() do?
migrateRadix() is a function in the ui codebase, defined in packages/shadcn/src/migrations/migrate-radix.ts.
Where is migrateRadix() defined?
migrateRadix() is defined in packages/shadcn/src/migrations/migrate-radix.ts at line 101.
What does migrateRadix() call?
migrateRadix() calls 1 function(s): migrateRadixFile.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free