https://github.com/toss/es-toolkit-codemod
https://github.com/toss/es-toolkit-codemod
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/toss/es-toolkit-codemod
- Owner: toss
- License: mit
- Created: 2025-06-12T11:48:20.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-15T07:53:03.000Z (12 months ago)
- Last Synced: 2025-06-15T08:25:01.752Z (12 months ago)
- Language: TypeScript
- Size: 1.1 MB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README-ko_kr.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README

# @es-toolkit/codemod ยท [](https://github.com/toss/slash/blob/main/LICENSE) [](https://www.npmjs.com/package/@es-toolkit/codemod) [](https://discord.gg/vGXbVjP2nY)
[English](https://github.com/toss/es-toolkit-codemod/blob/main/README.md) | ํ๊ตญ์ด
## ๐ ๋น ๋ฅธ ์์
```bash
# npm์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ
npx @es-toolkit/codemod src/
# yarn์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ
yarn dlx @es-toolkit/codemod src/
# ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ชจ๋ (๋ณ๊ฒฝ์ฌํญ์ ์ ์ฉํ์ง ์๊ณ ํ์ธ๋ง)
npx @es-toolkit/codemod src/ --dry
```
## ๐ ์ง์ํ๋ ๋ณํ
### 1. Default Import
```javascript
// Before
import _ from "lodash";
// After
import * as _ from "es-toolkit/compat";
```
### 2. Named Import
```javascript
// Before
import { map, filter, reduce } from "lodash";
// After
import { map, filter, reduce } from "es-toolkit/compat";
```
### 3. Individual Function Import
```javascript
// Before
import debounce from "lodash/debounce";
import throttle from "lodash/throttle";
// After
import debounce from "es-toolkit/compat/debounce";
import throttle from "es-toolkit/compat/throttle";
```
> [!NOTE]
> ๋ณ์/ํจ์ ์ด๋ฆ์ด ์ ์ง๋ผ์.
> e.g. `import debounceFn from 'lodash/debounce'` โ `import debounceFn from 'es-toolkit/compat/debounce'`
### 4. lodash-es Import
```javascript
// Before
import { map, filter } from "lodash-es";
// After
import { map, filter } from "es-toolkit/compat";
```
## ๐ฏ ์ฌ์ฉ๋ฒ
### ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ
```bash
npx @es-toolkit/codemod
```
### ์ต์
| ์ต์
| ์ค๋ช
| ์์ |
| --------------- | ------------------------------ | ---------------------- |
| `` | ๋ณํํ ํ์ผ ๋๋ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก | `src/` , `components/` |
| `--dry` | ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ชจ๋ (๋ณ๊ฒฝ ์ ์ฉ ์ํจ) | `--dry` |
| `--help` , `-h` | ๋์๋ง ํ์ | `--help` |
### ์ฌ์ฉ ์์
```bash
# ์ ์ฒด src ๋๋ ํ ๋ฆฌ ๋ณํ
npx @es-toolkit/codemod src/
# ํน์ ํ์ผ๋ง ๋ณํ
npx @es-toolkit/codemod src/utils/helpers.ts
# ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ชจ๋๋ก ๋ณ๊ฒฝ์ฌํญ ํ์ธ
npx @es-toolkit/codemod src/ --dry
# components ๋๋ ํ ๋ฆฌ๋ง ๋ณํ
npx @es-toolkit/codemod src/components/
```
## ๐ ๊ด๋ จ ๋งํฌ
- [es-toolkit ๊ณต์ ๋ฌธ์](https://es-toolkit.slash.page)
- [es-toolkit GitHub](https://github.com/toss/es-toolkit)
## License
MIT ยฉ Viva Republica, Inc. See [LICENSE](./LICENSE) for details.