English | 한국어
# Using npm
npx @es-toolkit/codemod src/
# Using yarn
yarn dlx @es-toolkit/codemod src/
# Preview mode (check changes without applying them)
npx @es-toolkit/codemod src/ --dry
// Before
import _ from "lodash";
// After
import * as _ from "es-toolkit/compat";
// Before
import { map, filter, reduce } from "lodash";
// After
import { map, filter, reduce } from "es-toolkit/compat";
// 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
The variable/function name will be preserved.
e.g. import debounceFn from 'lodash/debounce'
will be transformed to import debounceFn from 'es-toolkit/compat/debounce'
// Before
import { map, filter } from "lodash-es";
// After
import { map, filter } from "es-toolkit/compat";
npx @es-toolkit/codemod <path>
Option | Description | Example |
---|---|---|
<path> |
File or directory path to transform | src/ , components/ |
--dry |
Preview mode (don't apply changes) | --dry |
--help , -h |
Show help | --help |
# Transform entire src directory
npx @es-toolkit/codemod src/
# Transform specific file only
npx @es-toolkit/codemod src/utils/helpers.ts
# Check changes in preview mode
npx @es-toolkit/codemod src/ --dry
# Transform components directory only
npx @es-toolkit/codemod src/components/
MIT © Viva Republica, Inc. See LICENSE for details.