Skip to content

Commit

Permalink
outdated: Add support for --also=dev[elopment] and --only=prod[uction]
Browse files Browse the repository at this point in the history
PR-URL: npm/npm#9024
  • Loading branch information
bengl authored and iarna committed Aug 12, 2015
1 parent 493552b commit fbaa50d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ function outdated_ (args, path, tree, parentHas, depth, cb) {
// (All the save checking here is because this gets called from npm-update currently
// and that requires this logic around dev deps.)
// FIXME: Refactor npm update to not be in terms of outdated.
if ((npm.config.get('dev') || !npm.config.get('production')) &&
var dev = npm.config.get('dev') || /^dev(elopment)?$/.test(npm.config.get('also'))
var prod = npm.config.get('production') || /^prod(uction)?$/.test(npm.config.get('only'))
if ((dev || !prod) &&
(npm.config.get('save-dev') || (
!npm.config.get('save') && !npm.config.get('save-optional')))) {
Object.keys(tree.missingDevDeps).forEach(function (name) {
Expand Down Expand Up @@ -261,8 +263,8 @@ function outdated_ (args, path, tree, parentHas, depth, cb) {
types[dep.package.name] = 'optionalDependencies'
})
}
var doUpdate = npm.config.get('dev') || (
!npm.config.get('production') &&
var doUpdate = dev || (
!prod &&
!Object.keys(parentHas).length &&
!npm.config.get('global')
)
Expand Down

0 comments on commit fbaa50d

Please sign in to comment.