Skip to content

Instantly share code, notes, and snippets.

@crmckenzie
Created April 8, 2016 18:23
Show Gist options
  • Save crmckenzie/4e38b13835f4c9da55ca3aa3cff89c56 to your computer and use it in GitHub Desktop.
Save crmckenzie/4e38b13835f4c9da55ca3aa3cff89c56 to your computer and use it in GitHub Desktop.
var fs = require('fs');
fs.readFile('package.json', 'utf8', function(err, data){
console.log("reading package.json");
if (err) throw err;
obj = JSON.parse(data);
if (obj.devDependencies) {
for(var package in obj.devDependencies) {
version = obj.devDependencies[package].replace(/^\^/, '');
var cmd = "npm install -g " + package + " --version " + version;
console.log(cmd);
// execute the command
}
}
else {
console.log("no dev dependencies found.");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment