Created
April 8, 2016 18:23
-
-
Save crmckenzie/4e38b13835f4c9da55ca3aa3cff89c56 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
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