Skip to content

Latest commit

 

History

History
58 lines (33 loc) · 2.13 KB

HOW-TO-USE.md

File metadata and controls

58 lines (33 loc) · 2.13 KB

Installation

codemod requires Node.js v14+ to run.

To install globally:

npm i -g codemod

Usage

Prerequisite: Before running the codemod please make sure your git is in a clean slate and there are no local changes

Just run the below command to get started.

codemod

Step 1:

image

Once you run the command, it will ask you for the source file/files path where you want to run codmod. It can be an absolute path or relative path.

Path examples:

  • To select single file: ./packages/p2p/src/components/user/user-avatar/user-avatar.jsx
  • To select multiple files: ./packages/p2p/*/.jsx

codemod uses fast-glob internally to match file/files. You can check out fast-glob documentation for more match syntax.

Step 2:

image

Choose the codemod that you want to run. You can simply navigate with your arrow keys and press Enter to select.

image

Here, we selected Change extension codemod and keyed in tsx as new extension.

Once the codemod ran successfully, make sure to commit the changes to get better git diff.

Step 3:

image

Rerun codemod and pass the path where you want to run the Convert proptypes to TS codemod.

Note: Please make sure to pass in the new path after you changed the extension. Since we changed the extension to tsx, we are passing the path with .tsx extension. Path examples:

  • To select single file: ./packages/p2p/src/components/user/user-avatar/user-avatar.tsx
  • To select multiple files: ./packages/p2p/*/.tsx

After that, select Convert proptypes to TS codemod.