Last active
April 7, 2017 16:35
-
-
Save dhoward/8079cbca5c15e5cf0fe1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function transformer(file, api) { | |
const j = api.jscodeshift; | |
return j(file.source) | |
/* get all imports with the right local name and source */ | |
.find(j.ImportDeclaration, { | |
specifiers: [{ | |
local:{ | |
name:"Helmet" | |
} | |
}], | |
source: { | |
value: "@nfl/gridiron/addons" | |
} | |
}).forEach(statement => { | |
/* replace with the new import */ | |
j(statement).replaceWith(j.importDeclaration( | |
[ | |
j.importDefaultSpecifier(j.identifier("Helmet")) | |
], | |
j.literal("react-helmet") | |
)); | |
}).toSource(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment