Created
June 25, 2019 01:58
-
-
Save nireno/52b3ee8b55e0ab9a7448375f0af1ac38 to your computer and use it in GitHub Desktop.
Generate a script that would upgrade all npm dependencies to @latest
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
const { execSync } = require('child_process'); | |
let stdout = execSync('npm ls --json=true --depth=0'); | |
let packageJson = JSON.parse(stdout); | |
let packages = Object.keys(packageJson.dependencies); | |
let packagesString = packages | |
.map(package => `${package}@latest`) | |
.join(' '); | |
console.log(`npm install ${packagesString}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment