module-path-codemod
v1.0.0
Published
jscodeshift codemod to transform module paths in import and require statements
Downloads
4
Maintainers
Readme
module-path-codemod
jscodeshift codemod to transform module paths in import and require statements
Installation
npm install --save module-path-codemod
Usage
For example, to upgrade package paths from material-ui beta
(e.g. material-ui/Button
) to v1 (@material-ui/core/Button
),
do:
const {transformModulePath} = require('module-path-codemod')
module.exports = function(fileInfo, api) {
return transformModulePath(api.jscodeshift(fileInfo.source), module =>
module.replace(/^material-ui\//, '@material-ui/core/')
).toSource()
}