@macklinu/codemods
A collection of JavaScript codemod scripts for easier code migration
Scripts
All scripts should be executed with Node >=8.
requirejs-to-commonjs
Converts AMD modules (define()) to CommonJS modules (module.exports). This
codemod currently only handles converting AMD define() statements - global AMD
require() modification is not supported.
To run:
npx jscodeshift <files-or-glob> -t https://raw.githubusercontent.com/macklinu/codemods/master/src/requirejs-to-commonjs.jsDevelopment
yarn test
Runs the Jest test suite. Tip: run
yarn test --watch for interactive watch mode during development.
Jest also includes an ESLint runner, so running
yarn test will lint and test all source files.
Contributing
If you use any of these codemods and have bug reports / feature requests, please open an issue!