Vivid - Codemods
This repository contains a collection of codemod scripts using JSCodeshift that help update any API changes to our packages in our apps.
Usage
npx @rexlabs/codemods [name] [files]
# to see all available options
npx @rexlabs/codemods --help
Codemods
rename-react-whereabouts-imports
This mod will fix old imports from the deprecated @rexlabs/react-whereabouts package to import from @rexlabs/whereabouts instead. It maintains any given aliases etc, so there should be no breaking changes. E.g.
- import { Link } from '@rexlabs/react-wherebouts';
+ import { Link } from '@rexlabs/wherebouts';
- import { Link } from '@rexlabs/react-wherebouts';
- import { match } from '@rexlabs/wherebouts';
+ import { match, Link } from '@rexlabs/wherebouts';
- import { Link as Foo } from '@rexlabs/react-wherebouts';
- import { match } from '@rexlabs/wherebouts';
+ import { match, Link as Foo } from '@rexlabs/wherebouts';
How to write a new codemod
- Add a new folder in the
codemods/srcdirectory with the name you want to give your new transformer - Add the transformer, see JSCodeshift docs for help
- Your new transformer is now available via
node ./src/bin.js [name] ...