codemod
requires Node.js v14+ to run.
To install globally:
npm i -g codemod
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
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.
Choose the codemod that you want to run. You can simply navigate with your arrow keys and press Enter
to select.
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.
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.