@es-toolkit/codemod

0.0.1 • Public • Published

cover

@es-toolkit/codemod · MIT License NPM badge Discord Badge

English | 한국어

🚀 Quick Start

# 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

📋 Supported transformations

1. Default Import

// Before
import _ from "lodash";

// After
import * as _ from "es-toolkit/compat";

2. Named Import

// Before
import { map, filter, reduce } from "lodash";

// After
import { map, filter, reduce } from "es-toolkit/compat";

3. Individual Function Import

// 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'

4. lodash-es Import

// Before
import { map, filter } from "lodash-es";

// After
import { map, filter } from "es-toolkit/compat";

🎯 Usage

Basic Usage

npx @es-toolkit/codemod <path>

Options

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

Usage Examples

# 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/

🔗 Related Links

License

MIT © Viva Republica, Inc. See LICENSE for details.

Toss

Package Sidebar

Install

npm i @es-toolkit/codemod

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

11.7 kB

Total Files

6

Last publish

Collaborators

  • raon0211
  • dayong