Migrating Icons
Easily migrate from old icons to new icons.
Upgrade Methods
There are 2 methods you can apply depending on how you are currently using icons.
Codemod Script
If you are using any of the 3 icon packages below, you can easily upgrade to the renewed icon packages using the provided codemod script.
@seed-deesign/react-icon@seed-design/icon(deprecated)@karrotmarket/karrot-ui-icon(deprecated) (when using React components)
Icons used in the 3 packages are replaced with icons from @karrotmarket/react-monochrome-icon.
Manual Upgrade
You need to manually upgrade in the following cases:
- When using existing icons as PNG, SVG, or other file formats
- When using SVG files provided by
@karrotmarket/karrot-ui-icon(deprecated)
- When using SVG files provided by
- When using the following packages:
@seed-design/vue2-icon→ replaced with@daangn/vue2-monochrome-icon.@seed-design/vue3-icon→ replaced with@daangn/vue3-monochrome-icon.
Workflow
Since many changes will occur, it's good to check that there are no uncommitted changes before starting.
Codemod Script
Install Renewed Icon Packages
Install only the packages you need from the 2 options.
@karrotmarket/react-monochrome-icon- Monochrome icon package. Includes general icons, category icons, and service icons.
- Service icons provided by this package can only be used in black.
- When running codemod, all icons from existing packages are replaced with icons from this package.
@karrotmarket/react-multicolor-icon- Multicolor icon package. Includes category icons and service icons.
- Category and service icons provided by this package can only be used in the colors provided by the package.
- Multicolor icons previously used as SVG can be directly replaced with this package. You can install it only if needed.
Run Codemod Script
Run the replace-react-icon transform.
replace-react-icon
Learn more about this transform.
Verify Results
If all transformations complete without issues, you'll see results like this:
errors: Number of files where icon references could not be verified due to parsing errors.- If a file with an error has no code referencing old icons, you can ignore the error for that file.
- If a file has code referencing old icons, fix the problematic parts and re-run the script, or manually migrate the icons in that file.
unmodified: Number of files with no icon references, so no transformations were made.skipped: Number of files that are not targets for transformation, such as empty files.ok: Number of files where transformations were made.
Parsing errors can occur when running the codemod script. Parsing errors occur for reasons like:
- Using deprecated syntax like import assertion with
assert - Using reserved words like
packageas variable names
Format Code
Format the code using the formatter your project uses.
Remove Previous Packages
Verify that all old icons have been replaced, then remove the previous packages.
Check for Side Effects
- Check if side effects occurred and verify that changes were made as intended.
- During the design QA process, it may have been decided to use new icons instead of automatically changed icons. In such cases, refer to the Figma design file and apply it to the code.
- For places where multicolor icons need to be used, use the multicolor icon package.
Possible Side Effects
No Exactly Matching Renewed Icon
- Among the previous icons, the following 5 icons (15 variants total) do not have visually exact matches in the renewed icon package.
- When running the codemod script, they are converted to the recommended icon, but verification is required after changes as there are significant visual differences.
| Previous Icon Name | Renewed Icon Name |
|---|---|
IconBoldThin | |
IconBoldRegular | |
IconBoldFill | |
IconCobuyingThin | |
IconCobuyingRegular | |
IconCobuyingFill | |
IconDeliveryThin | |
IconDeliveryRegular | |
IconDeliveryFill | |
IconSuggestThin | |
IconSuggestRegular | |
IconSuggestFill | |
IconWriteStoryThin | |
IconWriteStoryRegular | |
IconWriteStoryFill |
- When using the codemod script, if 5 icons (15 variants total) are used, a message is printed to the terminal.
- When using the codemod script with the
--logflag, usage is recorded inmigrate-icons-warnings.log. - You can search the code directly using the following:
Multiple Previous Icons Replaced with One Renewed Icon
Previous icons and renewed icons correspond in an n:1 manner. Therefore, multiple different icons that were displayed on the same page may be replaced with the same renewed icon. Verify that the icons display as intended.
- Of the 3 variants of one previous icon, both the
Thinvariant andRegularvariant are replaced with theLinevariant in the renewed icon.- For example, both
IconForwardThinandIconForwardRegularare replaced withIconArrowRightLine. - The
Fillvariant of the previous icon is also replaced with theFillvariant in the renewed icon.
- For example, both
- There are also cases where multiple previous icons are replaced with one renewed icon.
- For example,
IconHeadphoneRegular,IconHelpcenterRegular, andIconHelperRegularare all replaced withIconHeadsetLine.
- For example,