22
33codemod-cli is a command line tool for generating, testing, and publishing codemods.
44
5- ## Installation
6-
7- ```
8- npm install --global codemod-cli
9-
10- # OR
11-
12- yarn global add codemod-cli
13- ```
14-
155## Usage
166
177The ` codemod-cli ` workflow is focused on managing a group of codemods.
188
199To get started you first need a project. You can generate a new codemod-cli project via:
2010
2111```
22- codemod-cli new <project-name>
12+ npx codemod-cli new <project-name>
2313```
2414
2515This will create a small project structure (` README.md ` , ` package.json ` , etc) which is
@@ -28,8 +18,8 @@ ready to help you manage your codemods.
2818Once you have a project, you can generate a new codemod:
2919
3020```
31- codemod-cli generate codemod <name of codemod> // jscodeshift js codemod
32- codemod-cli generate codemod <name of codemod> -t=hbs // ember-template-recast hbs codemod
21+ npx codemod-cli generate codemod <name of codemod> // jscodeshift js codemod
22+ npx codemod-cli generate codemod <name of codemod> -t=hbs // ember-template-recast hbs codemod
3323```
3424
3525This will setup a new codemod within your project at ` transforms/<name of codemod>/index.js `
@@ -38,14 +28,14 @@ along with a test harness, README, fixture directory, and an initial set of inpu
3828Once you have tweaked your codemod and its fixtures to your liking, it is time to run your tests:
3929
4030```
41- codemod-cli test
31+ npx codemod-cli test
4232```
4333
4434As you develop your codemod you may need additional fixtures (e.g. to test various combinations of
4535inputs). To generate a new fixture, run the following:
4636
4737```
48- codemod-cli generate fixture <name of codemod> <name of fixture>
38+ npx codemod-cli generate fixture <name of codemod> <name of fixture>
4939```
5040
5141This sets up two new files in ` transforms/<name of codemod>/__testfixtures__/ ` using the fixture name
@@ -55,7 +45,7 @@ Once you have things just how you like them with your new codemod (and your test
5545can update your project's README and your transforms README via:
5646
5747```
58- codemod-cli update-docs
48+ npx codemod-cli update-docs
5949```
6050
6151### File Types
@@ -134,16 +124,15 @@ Contributing
134124
135125* ` git clone git@github .com : rwjblue/ codemod- cli .git `
136126* ` cd codemod- cli`
137- * ` yarn `
127+ * ` npm ci `
138128
139129### Linting
140130
141- * ` yarn lint: js`
142- * ` yarn lint: js -- fix`
131+ * ` npm run lint`
143132
144133### Running tests
145134
146- * ` yarn test`
135+ * ` npm test`
147136
148137## License
149138
0 commit comments