Performing big changes to a codebase is always a little daunting. Doing each change by hand is time consuming and generally leads to errors, unless you have a good test suite in place.
Codemod is a tool that has been designed to help in this problem. In this interview, Ramana Venkata describes the tool in detail.
My name is Ramana Venkata. I am front-end developer from India. I have been following the React Community since a year and half or so. I wanted to contribute to this community from that but I couldn't due to my commitments at college and lack of experience I guess. But now that I have started working, I have a good amount of free time and I am trying to put good use.
We have plethora of tools but very little documentation. Sometimes the documentation exists but you can hardly learn anything from it. Sometimes the examples are there but they are not explained. So currently, my main focus is on improving tooling and the documentation around it. I want to make them more accessible.
I think every library author, that wants to make a breaking changes to their API, should at least consider the possibility of writing a codemod. You can potentially run codemods in the postinstall lifecycle hook of npm to update your code for any breaking changes that library introduces. This will probably make library authors worry less about breaking changes and spend more time on implementing great stuff.
As a natural next step, you can learn about Babel plugins. It is very easy to write them with the help of AST Explorer. I think it's possible to write a plugin that provides auto-completion engine like Tern, but a little more advanced.
Imagine auto-completing a React component with all the required props and we can show type of props when you hover over it etc.,. You can use it for compile time transforms also. For example, I think the classnames package by Jed Watson (which is amazing btw) can be replaced by a simple Babel transform.
I think there are is a lot of untapped potential there. We just need more time for the tools to mature and for that we need more contribution, adoption and feedback from the community.
I think Codemod are just getting started (in the jscodeshift sense to make breaking changes to the API, etc.,). It is still a new tool the community even though it has been there for sometime. I have heard about it a lot of times but never really cared about it. It is Christoph Pojer's talk on Codemods which gave me the really inspiration to try it out.
For example, Ember provides new releases on a six week cycle. If you have a large code-base in Ember, getting rid of all the deprecation warnings can be a nightmare and doing it every six weeks is not fun at all. Codemods can ease some of that pain.
I think you should either interview Felix Kling or Christoph Pojer.
Thanks for the interview Ramana! I think Codemod is one of those tools that has great potential in taking some edge of development. I hope it becomes more popular and we see more adoption.
From a library consumer's point of view this can help a lot. I feel people aren't just that aware of the tool yet but perhaps that will change during this year.
If you are interested in the topic, I recommend checking out Ramana's in-depth tutorial. I've listed various other resources below: