A collection of JavaScript codemod scripts for easier code migration
All scripts should be executed with Node >=8.
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.js
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.
If you use any of these codemods and have bug reports / feature requests, please open an issue!