summaryrefslogtreecommitdiff
path: root/deps/npm/lib/install
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2019-10-08 08:57:31 -0700
committerRich Trott <rtrott@gmail.com>2019-10-15 11:00:21 -0700
commit3ebaf6b9bc495e5931e0ef2cd0726e8b5ea3d0b1 (patch)
tree10ad09195348814103bb3c6657fb62c5f8609646 /deps/npm/lib/install
parented5eaa0495fb54f3a29c39d0d4eefd5e258f5b05 (diff)
downloadnode-new-3ebaf6b9bc495e5931e0ef2cd0726e8b5ea3d0b1.tar.gz
deps: update npm to 6.12.0
Update npm to 6.12.0 Now `npm ci` runs prepare scripts for git dependencies, and respects the `--no-optional` argument. Warnings for `engine` mismatches are printed again. Various other fixes and cleanups. PR-URL: https://github.com/nodejs/node/pull/29885 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Christian Clauss <cclauss@me.com>
Diffstat (limited to 'deps/npm/lib/install')
-rw-r--r--deps/npm/lib/install/actions.js2
-rw-r--r--deps/npm/lib/install/deps.js2
-rw-r--r--deps/npm/lib/install/validate-args.js25
3 files changed, 20 insertions, 9 deletions
diff --git a/deps/npm/lib/install/actions.js b/deps/npm/lib/install/actions.js
index a34d03ffe2..e26432b77c 100644
--- a/deps/npm/lib/install/actions.js
+++ b/deps/npm/lib/install/actions.js
@@ -49,7 +49,7 @@ Object.keys(actions).forEach(function (actionName) {
if (pkg.knownInstallable) {
actionP = runAction(action, staging, pkg, log)
} else {
- actionP = isInstallable(pkg.package).then(() => {
+ actionP = isInstallable(null, pkg.package).then(() => {
pkg.knownInstallable = true
return runAction(action, staging, pkg, log)
})
diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js
index bfc94ae504..dfe30b6c0f 100644
--- a/deps/npm/lib/install/deps.js
+++ b/deps/npm/lib/install/deps.js
@@ -665,7 +665,7 @@ function resolveWithNewModule (pkg, tree, log, next) {
validate('OOOF', arguments)
log.silly('resolveWithNewModule', packageId(pkg), 'checking installable status')
- return isInstallable(pkg, (err) => {
+ return isInstallable(tree, pkg, (err) => {
let installable = !err
addBundled(pkg, (bundleErr) => {
var parent = earliestInstallable(tree, tree, pkg, log) || tree
diff --git a/deps/npm/lib/install/validate-args.js b/deps/npm/lib/install/validate-args.js
index 65b660417a..b680a1b24b 100644
--- a/deps/npm/lib/install/validate-args.js
+++ b/deps/npm/lib/install/validate-args.js
@@ -16,7 +16,7 @@ module.exports = function (idealTree, args, next) {
chain([
[hasMinimumFields, pkg],
[checkSelf, idealTree, pkg, force],
- [isInstallable, pkg]
+ [isInstallable, idealTree, pkg]
], done)
}, next)
}
@@ -31,13 +31,24 @@ function hasMinimumFields (pkg, cb) {
}
}
-function getWarnings (pkg) {
- while (pkg.parent) pkg = pkg.parent
- if (!pkg.warnings) pkg.warnings = []
- return pkg.warnings
+function setWarnings (idealTree, warn) {
+ function top (tree) {
+ if (tree.parent) return top(tree.parent)
+ return tree
+ }
+
+ var topTree = top(idealTree)
+ if (!topTree.warnings) topTree.warnings = []
+
+ if (topTree.warnings.every(i => (
+ i.code !== warn.code ||
+ i.required !== warn.required ||
+ i.pkgid !== warn.pkgid))) {
+ topTree.warnings.push(warn)
+ }
}
-var isInstallable = module.exports.isInstallable = function (pkg, next) {
+var isInstallable = module.exports.isInstallable = function (idealTree, pkg, next) {
var force = npm.config.get('force')
var nodeVersion = npm.config.get('node-version')
if (/-/.test(nodeVersion)) {
@@ -48,7 +59,7 @@ var isInstallable = module.exports.isInstallable = function (pkg, next) {
var strict = npm.config.get('engine-strict')
checkEngine(pkg, npm.version, nodeVersion, force, strict, iferr(next, thenWarnEngineIssues))
function thenWarnEngineIssues (warn) {
- if (warn) getWarnings(pkg).push(warn)
+ if (idealTree && warn) setWarnings(idealTree, warn)
checkPlatform(pkg, force, next)
}
}