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