To run the codemod:

Prerequisite

  1. Nodejs >= 16
  2. Install jscodeshift globally
$ npm install -g jscodeshift
  1. Clone this repo to your machine (in the same level as logie-fe if possible)
$ git clone git@github.com:alvin883/logie-codemod.git
  1. Go there, install the packages
$ cd ./logie-codemod
$ yarn install
  1. Install ripgrep if you didn't have it yet, ripgrep is needed to do file content search, for other installation please see here: https://github.com/BurntSushi/ripgrep#installation
# Fedora Linux
$ sudo dnf install ripgrep

# MacOS
$ brew install ripgrep

Run codemod

This step assume you cloned the repo in the same level as logie-fe

  1. Go back to logie-fe repo
cd ../logie-fe
  1. Run jscodeshift
$ jscodeshift --extensions=ts,tsx -t ../logie-codemod/transformer.ts --parser tsx src

To save log output into a file

$ jscodeshift --extensions=ts,tsx -t ../logie-codemod/transformer.ts --parser tsx src >> logs.txt

Note

Everthing under src is just a test case