diff --git a/transforms/replace-enzyme-adapter.js b/transforms/replace-enzyme-adapter.js new file mode 100644 index 0000000..190a078 --- /dev/null +++ b/transforms/replace-enzyme-adapter.js @@ -0,0 +1,19 @@ +//replace enzyme react-17 adapter.js +export default (fileInfo, api) => { + const j = api.jscodeshift; + const root = j(fileInfo.source); + return root.find(j.ImportDeclaration, { + type: "ImportDeclaration", + source: { + type: "Literal", + value: "enzyme-adapter-react-16", + }, + }).find(j.Literal).replaceWith(nodePath => { + const {node} = nodePath; + // console.log("*****", node.value); + node.value = "@wojtekmaj/enzyme-adapter-react-17"; + // console.log("*****", node.value); + return node; + }).toSource(); + +}; \ No newline at end of file