avajs / ava-codemods

Codemods for AVA
https://ava.li
MIT License
68 stars 16 forks source link

Add CLI to help select/run codemods #9

Closed jfmengels closed 8 years ago

jfmengels commented 8 years ago

I've added a CLI tool to help move from a version of AVA to another. It kind of looks like this:

image

I've created a file codemods.json which should list the versions that contain codemod-able changes. For now, there is only one entry for v0.14, which is the codemods needed to go from <0.14.0 to 0.14.0. Hopefully, we will later only have create the codemods and modify that file.

We could later have a different question for selecting upgrade codemods (0.13 --> 0.14) or transition codemods (mocha --> ava).

Pretty sure this will not when installed globally (it needs to find jscodeshift in the $PATH), would welcome some tips.

jfmengels commented 8 years ago

Actually, do you guys mind if I create a new repo/package for this and we integrate it? I'm thinking this could be of use for quite a few projects.

sindresorhus commented 8 years ago

@jfmengels Can you fix and merge now and do that later? This is the only thing blocking a new AVA release. Definitely a good idea though.

jfmengels commented 8 years ago

Sure, will do!

sindresorhus commented 8 years ago

Tests are failing. Maybe also update the docs about running it and what AVA version migrations currently supported.

jfmengels commented 8 years ago

Should we recommend to install it globally? Makes it easier to run the command.

sindresorhus commented 8 years ago

@jfmengels Yup, use https://github.com/sindresorhus/meow to handle the help stuff.

jamestalmage commented 8 years ago

Yes. This should definitely be installed globally.

jamestalmage commented 8 years ago

meow

He's doing everything with prompts now. So no need for meow yet

sindresorhus commented 8 years ago

@jamestalmage I know, but meow handles other things too, like --version and --help: https://github.com/sindresorhus/meow#features We should definitely have --help.

jfmengels commented 8 years ago

I've updated the PR. Thanks for all the tips @jamestalmage.

Have updated the readme a bit, can be built on later.

@sindresorhus Fair point for --version/--help. I'm adding it now (also fixing a bug now that I've added globby).

The way things work now, all files in the project will be listed in the command when launching jscodeshift. Will that not break a console limit?

sindresorhus commented 8 years ago

Note: https://github.com/jamestalmage/ava-codemods/pull/9#discussion_r58757388

sindresorhus commented 8 years ago

We should warn people the following either in the readme or the CLI. Something like:

Ensure you have a backup of your tests and commit the latest changes before running this.

jfmengels commented 8 years ago

All comments taken into account.

jamestalmage commented 8 years ago

Nice!

jfmengels commented 8 years ago

sindresorhus commented 8 years ago

Wondrous‼️ ✨