# Migrating Icons
URL: /react/migration/migrating-icons
Source: https://github.com/daangn/seed-design/blob/dev/docs/content/react/migration/migrating-icons.mdx
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`](https://www.npmjs.com/package/@seed-design/react-icon)
- [`@seed-design/icon`](https://www.npmjs.com/package/@seed-design/icon) (deprecated)
- [`@karrotmarket/karrot-ui-icon`](https://www.npmjs.com/package/@karrotmarket/karrot-ui-icon) (deprecated) (when using React components)
Icons used in the 3 packages are replaced with icons from [`@karrotmarket/react-monochrome-icon`](https://github.com/daangn/seed-icon-v3/pkgs/npm/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`](https://www.npmjs.com/package/@karrotmarket/karrot-ui-icon) (deprecated)
- When using the following packages:
- [`@seed-design/vue2-icon`](https://www.npmjs.com/package/@seed-design/vue2-icon) → replaced with [`@daangn/vue2-monochrome-icon`](https://github.com/daangn/seed-icon-v3/pkgs/npm/vue2-monochrome-icon).
- [`@seed-design/vue3-icon`](https://www.npmjs.com/package/@seed-design/vue3-icon) → replaced with [`@daangn/vue3-monochrome-icon`](https://github.com/daangn/seed-icon-v3/pkgs/npm/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
- npm: npm install @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
- pnpm: pnpm add @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
- yarn: yarn add @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
- bun: bun add @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
Install only the packages you need from the 2 options.
- [`@karrotmarket/react-monochrome-icon`](https://github.com/daangn/seed-icon-v3/pkgs/npm/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`](https://github.com/daangn/seed-icon-v3/pkgs/npm/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.
```shell
npx @seed-design/codemod@latest replace-react-icon
```
Learn more about this transform.
#### Verify Results
If all transformations complete without issues, you'll see results like this:
```
All done.
Results:
0 errors // [!code highlight]
439 unmodified
1 skipped
27 ok
Time elapsed: 43.376seconds
```
- `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.
```
ERR /Users/seed/foo/bar.js Transformation error (Unexpected reserved word 'package'. (3:3))
```
Parsing errors can occur when running the codemod script. Parsing errors occur for reasons like:
- Using deprecated syntax like [import assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-3.html#import-attributes) with `assert`
- Using reserved words like `package` as 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.
- npm: npm uninstall @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon
- pnpm: pnpm remove @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon
- yarn: yarn remove @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon
- bun: bun remove @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon
#### Check for Side Effects
- Check if [side effects](#possible-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](https://github.com/daangn/seed-icon-v3/pkgs/npm/react-multicolor-icon).
### Manual Upgrade
#### Remove Previous Packages
Remove the previous icon packages.
- npm: npm uninstall @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon @seed-design/vue2-icon @seed-design/vue3-icon
- pnpm: pnpm remove @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon @seed-design/vue2-icon @seed-design/vue3-icon
- yarn: yarn remove @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon @seed-design/vue2-icon @seed-design/vue3-icon
- bun: bun remove @seed-design/icon @seed-design/react-icon @karrotmarket/karrot-ui-icon @seed-design/vue2-icon @seed-design/vue3-icon
#### Install Renewed Packages
##### React
- npm: npm install @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
- pnpm: pnpm add @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
- yarn: yarn add @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
- bun: bun add @karrotmarket/react-monochrome-icon @karrotmarket/react-multicolor-icon
##### Vue 2
- npm: npm install @daangn/vue2-monochrome-icon @daangn/vue2-multicolor-icon
- pnpm: pnpm add @daangn/vue2-monochrome-icon @daangn/vue2-multicolor-icon
- yarn: yarn add @daangn/vue2-monochrome-icon @daangn/vue2-multicolor-icon
- bun: bun add @daangn/vue2-monochrome-icon @daangn/vue2-multicolor-icon
##### Vue 3
- npm: npm install @daangn/vue3-monochrome-icon @daangn/vue3-multicolor-icon
- pnpm: pnpm add @daangn/vue3-monochrome-icon @daangn/vue3-multicolor-icon
- yarn: yarn add @daangn/vue3-monochrome-icon @daangn/vue3-multicolor-icon
- bun: bun add @daangn/vue3-monochrome-icon @daangn/vue3-multicolor-icon
Install only the packages you need from the 2 options.
- `@daangn/*-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.
- `@daangn/*-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.
#### Change Icon Names
Refer to the [icon migration reference](/docs/migration/migration-reference#iconography) document and modify the code to use the renewed package.
- The existing icon `IconHome*` has been renamed to `IconHouse*` in the new icon.
- The existing icon `IconHouse*` has been renamed to `IconWindow4House*` in the new icon.
Therefore, during manual migration, you must be careful not to accidentally change `IconHome*` to `IconWindow4House*`.
**It is recommended to migrate `IconHouse*` first** and then migrate `IconHome*`.
#### Check for Side Effects
- Check if [side effects](#possible-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 those specified in [icon migration reference](/docs/migration/migration-reference#iconography). 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](https://github.com/daangn/seed-icon-v3/pkgs/npm/react-multicolor-icon).
## 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 |
| ------------------ | ----------------- |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
- When using the codemod script, if 5 icons (15 variants total) are used, a message is printed to the terminal.
```
REP Changed ... to ..., but you need to verify if the changed icon is appropriate
```
- When using the codemod script with the `--log` flag, usage is recorded in `migrate-icons-warnings.log`.
- You can search the code directly using the following:
* Regex: (IconBold|IconCobuying|IconDelivery|IconSuggest|IconWriteStory)(Thin|Regular|Fill)|(IconTUppercaseSerif|IconShoppingbag2Stacked|IconTruck|IconLightbulbDot5|IconHorizline2VerticalChatbubbleRight)(Line|Fill)
* git grep: git grep -E '(IconBold|IconCobuying|IconDelivery|IconSuggest|IconWriteStory)(Thin|Regular|Fill)|(IconTUppercaseSerif|IconShoppingbag2Stacked|IconTruck|IconLightbulbDot5|IconHorizline2VerticalChatbubbleRight)(Line|Fill)'
### 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 `Thin` variant and `Regular` variant are replaced with the `Line` variant in the renewed icon.
- For example, both `IconForwardThin` and `IconForwardRegular` are replaced with [`IconArrowRightLine`](/foundations/iconography/library?icon=icon_arrow_right_line).
- The `Fill` variant of the previous icon is also replaced with the `Fill` variant in the renewed icon.
- There are also cases where multiple previous icons are replaced with one renewed icon.
- For example, `IconHeadphoneRegular`, `IconHelpcenterRegular`, and `IconHelperRegular` are all replaced with [`IconHeadsetLine`](/foundations/iconography/library?icon=icon_headset_line).