migrate() — ui Function Reference
Architecture documentation for the migrate() function in migrate.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 36bbd160_51c7_e3b6_ecaf_3bac998c8a83["migrate()"] da749efe_50ce_753c_dc60_9072204cbe6f["migrate.ts"] 36bbd160_51c7_e3b6_ecaf_3bac998c8a83 -->|defined in| da749efe_50ce_753c_dc60_9072204cbe6f style 36bbd160_51c7_e3b6_ecaf_3bac998c8a83 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/commands/migrate.ts lines 57–113
.action(async (migration, migratePath, opts) => {
try {
const options = migrateOptionsSchema.parse({
cwd: path.resolve(opts.cwd),
migration,
path: migratePath,
list: opts.list,
yes: opts.yes,
})
if (options.list || !options.migration) {
logger.info("Available migrations:")
for (const migration of migrations) {
logger.info(`- ${migration.name}: ${migration.description}`)
}
return
}
if (!options.migration) {
throw new Error(
"You must specify a migration. Run `shadcn migrate --list` to see available migrations."
)
}
let { errors, config } = await preFlightMigrate(options)
if (
errors[ERRORS.MISSING_DIR_OR_EMPTY_PROJECT] ||
errors[ERRORS.MISSING_CONFIG]
) {
throw new Error(
"No `components.json` file found. Ensure you are at the root of your project."
)
}
if (!config) {
throw new Error(
"Something went wrong reading your `components.json` file. Please ensure you have a valid `components.json` file."
)
}
if (options.migration === "icons") {
await migrateIcons(config)
}
if (options.migration === "radix") {
await migrateRadix(config, { yes: options.yes, path: options.path })
}
if (options.migration === "rtl") {
await migrateRtl(config, { yes: options.yes, path: options.path })
}
} catch (error) {
logger.break()
handleError(error)
}
})
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does migrate() do?
migrate() is a function in the ui codebase, defined in packages/shadcn/src/commands/migrate.ts.
Where is migrate() defined?
migrate() is defined in packages/shadcn/src/commands/migrate.ts at line 57.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free