Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 64 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. const { readFileSync } = require('fs')
  2.  
  3. const generateNpmInstallScript = (obj, initialScript) => {
  4.   return Object.keys(obj).reduce((script, key) => {
  5.     return script + ' ' + key + '@latest'
  6.   }, initialScript)
  7. }
  8.  
  9. const contents = readFileSync('./package.json', 'utf-8')
  10.  
  11. const {
  12.   dependencies,
  13.   devDependencies
  14. } = JSON.parse(contents)
  15.  
  16. console.log(generateNpmInstallScript(dependencies, 'npm install'))
  17. console.log(generateNpmInstallScript(devDependencies, 'npm install --save-dev'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top