Skip to main content

Cli

Explains how to run codemod-kit using the cli method.

Installation​

install the codemod-kit

npm install -g codemod-kit

Usage​

Perform some steps by running the commands below:

npx codemod-kit

type​

Select a transformer type from the list

path​

Enter the path to the file or directory to transform split by comma(,). Supports glob patterns.

parser​

Select the parser to use from the list.

options​

Enter the options that match the type in JSON format.

Example​

Let's say we want to perform a transformation like the example below.

import { App } from "foo";

const result = <App title="hello" description="this is dashboard page"/>

You can convert the code by entering the values ​​below in order.

type​

add-props

path​

src/*/.ts,src/foo.ts

parser​

tsx

options​

{
"componentSourceType": "absolute",
"componentNameType": "named",
"componentSource": "foo",
"componentName": "App",
"propsName": "author",
"propsValue": "John"
}