Skip to content

Commit

Permalink
feat(args): allow to pass in arguments to final npm install command
Browse files Browse the repository at this point in the history
(e.g. --ignore-scripts)
  • Loading branch information
Ahmad Nassri committed Mar 31, 2017
1 parent 5710433 commit d3810c0
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,29 @@ const spawn = require('@ahmadnassri/spawn-promise')

let packages

const argv = process.argv.slice(2)
const group = argv.shift()

// exit early
if (!group) {
console.error('group required')
process.exit(1)
}

try {
packages = list(process.cwd(), process.argv[2])
packages = list(process.cwd(), group)
} catch (err) {
console.log(err.message)
process.exit()
console.error(err.message)
process.exit(1)
}

if (packages.length === 0) {
console.log('no packages')
process.exit()
process.exit(0)
}

spawn('npm', ['install', packages.join(' ')], { encoding: 'utf8' })
const args = ['install', packages.join(' ')].concat(argv)

spawn('npm', args, { encoding: 'utf8' })
.then(streams => console.log(streams.stdout))
.catch(err => console.log(err.stderr))
.catch(err => console.error(err.stderr))

0 comments on commit d3810c0

Please sign in to comment.