Skip to content

Commit

Permalink
validate-args: Consume warnings from new npm-install-checks
Browse files Browse the repository at this point in the history
PR-URL: npm#11212
Credit: @iarna
Reviewed-By: @othiym23
  • Loading branch information
iarna committed Jan 21, 2016
1 parent 6cbbced commit 6952f79
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/install/validate-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var validate = require('aproba')
var asyncMap = require('slide').asyncMap
var chain = require('slide').chain
var npmInstallChecks = require('npm-install-checks')
var iferr = require('iferr')
var checkEngine = npmInstallChecks.checkEngine
var checkPlatform = npmInstallChecks.checkPlatform
var npm = require('../npm.js')
Expand All @@ -19,14 +20,21 @@ module.exports = function (idealTree, args, next) {
}, next)
}

function getWarnings (pkg) {
while (pkg.parent) pkg = pkg.parent
if (!pkg.warnings) pkg.warnings = []
return pkg.warnings
}

var isInstallable = module.exports.isInstallable = function (pkg, next) {
var force = npm.config.get('force')
var nodeVersion = npm.config.get('node-version')
var strict = npm.config.get('engine-strict')
chain([
[checkEngine, pkg, npm.version, nodeVersion, force, strict],
[checkPlatform, pkg, force]
], next)
checkEngine(pkg, npm.version, nodeVersion, force, strict, iferr(next, thenWarnEngineIssues))
function thenWarnEngineIssues (warn) {
if (warn) getWarnings(pkg).push(warn)
checkPlatform(pkg, force, next)
}
}

function checkSelf (idealTree, pkg, force, next) {
Expand Down

0 comments on commit 6952f79

Please sign in to comment.