migrateIcons() — ui Function Reference
Architecture documentation for the migrateIcons() function in migrate-icons.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD e664e002_0388_4db6_2b3e_9fed9a1b3640["migrateIcons()"] c417f44a_fbc3_0d59_2fa7_12379c8ead9a["migrate-icons.ts"] e664e002_0388_4db6_2b3e_9fed9a1b3640 -->|defined in| c417f44a_fbc3_0d59_2fa7_12379c8ead9a e61ab54c_2257_1948_6d37_baaeb3351aac["migrateIconsFile()"] e664e002_0388_4db6_2b3e_9fed9a1b3640 -->|calls| e61ab54c_2257_1948_6d37_baaeb3351aac style e664e002_0388_4db6_2b3e_9fed9a1b3640 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/migrations/migrate-icons.ts lines 18–131
export async function migrateIcons(config: Config) {
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."
)
}
const uiPath = config.resolvedPaths.ui
const [files, registryIcons] = await Promise.all([
fg("**/*.{js,ts,jsx,tsx}", {
cwd: uiPath,
}),
getRegistryIcons(),
])
if (Object.keys(registryIcons).length === 0) {
throw new Error("Something went wrong fetching the registry icons.")
}
const libraryChoices = Object.entries(LEGACY_ICON_LIBRARIES).map(
([name, iconLibrary]) => ({
title: iconLibrary.name,
value: name,
})
)
const migrateOptions = await prompts([
{
type: "select",
name: "sourceLibrary",
message: `Which icon library would you like to ${highlighter.info(
"migrate from"
)}?`,
choices: libraryChoices,
},
{
type: "select",
name: "targetLibrary",
message: `Which icon library would you like to ${highlighter.info(
"migrate to"
)}?`,
choices: libraryChoices,
},
])
if (migrateOptions.sourceLibrary === migrateOptions.targetLibrary) {
throw new Error(
"You cannot migrate to the same icon library. Please choose a different icon library."
)
}
if (
!(
migrateOptions.sourceLibrary in LEGACY_ICON_LIBRARIES &&
migrateOptions.targetLibrary in LEGACY_ICON_LIBRARIES
)
) {
throw new Error("Invalid icon library. Please choose a valid icon library.")
}
const sourceLibrary =
LEGACY_ICON_LIBRARIES[
migrateOptions.sourceLibrary as keyof typeof LEGACY_ICON_LIBRARIES
]
const targetLibrary =
LEGACY_ICON_LIBRARIES[
migrateOptions.targetLibrary as keyof typeof LEGACY_ICON_LIBRARIES
]
const { confirm } = await prompts({
type: "confirm",
name: "confirm",
initial: true,
message: `We will migrate ${highlighter.info(
files.length
)} files in ${highlighter.info(
`./${path.relative(config.resolvedPaths.cwd, uiPath)}`
)} from ${highlighter.info(sourceLibrary.name)} to ${highlighter.info(
targetLibrary.name
)}. Continue?`,
})
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does migrateIcons() do?
migrateIcons() is a function in the ui codebase, defined in packages/shadcn/src/migrations/migrate-icons.ts.
Where is migrateIcons() defined?
migrateIcons() is defined in packages/shadcn/src/migrations/migrate-icons.ts at line 18.
What does migrateIcons() call?
migrateIcons() calls 1 function(s): migrateIconsFile.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free