Codemods, or jscodeshift transforms, are small programs that help automate changes in a codebase. Think of them as search and replace on steroids. This tool helps you to create a simple CLI to apply the codemods that you wrote, so that users can easily upgrade their code between various releases of your library.
Install
$ npm install --save lib-upgrader jscodeshift
Usage
Create a cli.js file at the root of your project that will serve as your upgrader executable, and add this sample code (sample available here):
Unless you committed your changes and your directory is clean, when you run it, the program will exit and ask you to either commit or stash your changes. You can force through it by adding --force to the command line.