Created
February 17, 2017 16:03
-
-
Save jaysalvat/7f81bf0bf0fcbc306a9a9d6104ad229a to your computer and use it in GitHub Desktop.
Check NPM for outdated dependencies and output a package.json friendly JSON.
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
'use strict'; | |
let exec = require('child_process').exec; | |
exec('npm outdated --json', (err, stdout, sdterr) => { | |
if (!stdout) { | |
process.exit(); | |
} | |
let json = JSON.parse(stdout), | |
keys = Object.keys(json), | |
output = {}; | |
for (let k of keys) { | |
output[k] = '^' + json[k].latest; | |
} | |
console.log(JSON.stringify(output, null, 4)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment