Created
August 11, 2017 22:27
-
-
Save bgando/f027191e9601c694e0e23e3a46f28e70 to your computer and use it in GitHub Desktop.
This file contains 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
function replaceVersion(deps) { | |
if(deps["can-stache-key"]) { | |
deps["can-stache-key"] = "^0.1.0" | |
} | |
return deps; | |
} | |
module.exports = function transformer(file, api) { | |
var src = file.source; | |
try { | |
src = JSON.parse(src); | |
src.dependencies = replaceVersion(src.dependencies); | |
src.devDependencies = replaceVersion(src.devDependencies); | |
// print result with 2-space indentation | |
src = JSON.stringify(src, null, 2) + '\n'; | |
} catch(e) { | |
console.error(e); | |
} | |
return src; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment