aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/lib/install/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/install/actions.js')
-rw-r--r--deps/npm/lib/install/actions.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/deps/npm/lib/install/actions.js b/deps/npm/lib/install/actions.js
index 1c7462030c..7c3f97cefc 100644
--- a/deps/npm/lib/install/actions.js
+++ b/deps/npm/lib/install/actions.js
@@ -3,13 +3,14 @@ var path = require('path')
var validate = require('aproba')
var chain = require('slide').chain
var asyncMap = require('slide').asyncMap
-var log = require('npmlog')
+var iferr = require('iferr')
var andFinishTracker = require('./and-finish-tracker.js')
var andAddParentToErrors = require('./and-add-parent-to-errors.js')
var failedDependency = require('./deps.js').failedDependency
-var packageId = require('../utils/package-id.js')
var moduleName = require('../utils/module-name.js')
var buildPath = require('./build-path.js')
+var reportOptionalFailure = require('./report-optional-failure.js')
+var isInstallable = require('./validate-args.js').isInstallable
var actions = {}
@@ -45,7 +46,23 @@ Object.keys(actions).forEach(function (actionName) {
if (!pkg.commit) pkg.commit = []
pkg.commit.push(action.commit)
}
- return action(top, buildpath, pkg, log, andFinishTracker(log, andAddParentToErrors(pkg.parent, andHandleOptionalDepErrors(pkg, next))))
+ if (pkg.knownInstallable) {
+ return thenRunAction()
+ } else {
+ return isInstallable(pkg.package, iferr(andDone(next), andMarkInstallable(thenRunAction)))
+ }
+ function andMarkInstallable (cb) {
+ return function () {
+ pkg.knownInstallable = true
+ cb()
+ }
+ }
+ function thenRunAction () {
+ action(top, buildpath, pkg, log, andDone(next))
+ }
+ function andDone (cb) {
+ return andFinishTracker(log, andAddParentToErrors(pkg.parent, andHandleOptionalDepErrors(pkg, cb)))
+ }
}
})
@@ -70,8 +87,7 @@ function andHandleOptionalDepErrors (pkg, next) {
if (isFatal) anyFatal = true
}
if (anyFatal) return next.apply(null, arguments)
- log.warn('install:' + packageId(pkg), er.message)
- log.verbose('install:' + packageId(pkg), er.stack)
+ reportOptionalFailure(pkg, null, er)
next()
}
}