jamestalmage / generator-codemod

A generator to create codemods quickly.
MIT License
11 stars 1 forks source link

include registerMethods examples in generated output. #1

Closed jamestalmage closed 5 years ago

jamestalmage commented 8 years ago

It's a bit more verbose, but provides some helpful reminders about the API.

jamestalmage commented 8 years ago

@sindresorhus @jfmengels - I'd like your feedback if you think this more verbose example is good for the default output. It uses the registerMethods API.

jfmengels commented 8 years ago

Sorry, haven't taken the time to look at this repo. Will free some time tonight for it

jfmengels commented 8 years ago

I'm not that familiar with jscodeshift's API. I know the simple stuff mostly (and then again, I've forgotten most of it since my last real use of it), but I didn't know the registerMethods API.

I feel like this is a bit too complicated for beginners. I think that a simple "find and replace" is a good starter, without having to use registerMethods that look like they're needed for some heavy use cases. Then again, maybe this is a pretty great tool and I missed out on learning about it.

If you want to provide helper reminders, you could add links to the API docs of the things you think are useful or used often.

Another thing you can do to help the user is to give them an astexplorer link in some comment, so that they can play with it directly. I've prepared one here with the current default example https://astexplorer.net/#/rLeSwzcRGl (give a new one every time the example gets updated).

jamestalmage commented 8 years ago

I feel like this is a bit too complicated for beginners.

Yeah, that was my main concern.

Maybe just put this in a separate template choice.

sindresorhus commented 8 years ago

Another thing you can do to help the user is to give them an astexplorer link in some comment

👍 astexplorer is amazingly useful.