Last active
January 7, 2020 15:33
-
-
Save dragonman225/a83be3582b2ee2e4aff3e20b52700e3d to your computer and use it in GitHub Desktop.
Upgrade dependencies to the latest with yarn.
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
/** | |
* Upgrade dependencies to the latest with pnpm. | |
*/ | |
const { spawn } = require('child_process') | |
const manifest = require('../package.json') | |
const devDeps = Object.keys(manifest.devDependencies | |
? manifest.devDependencies : []) | |
const deps = Object.keys(manifest.dependencies | |
? manifest.dependencies : []) | |
const devDepsLatest = devDeps.map(d => `${d}@latest`) | |
const depsLatest = deps.map(d => `${d}@latest`) | |
const bin = 'yarn' | |
let args = ['upgrade'] | |
args = args.concat(devDepsLatest) | |
args = args.concat(depsLatest) | |
const upgrade = spawn(bin, args) | |
upgrade.stdout.on('data', (data) => { | |
console.log(data.toString()) | |
}) | |
upgrade.stderr.on('data', (data) => { | |
console.error(`stderr: ${data.toString()}`) | |
}) | |
upgrade.on('close', (code) => { | |
console.log(`child process exited with code ${code}`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment