From a7c7c703aff362f06ef5d49451a0f79fd289910f Mon Sep 17 00:00:00 2001 From: claudiahdz Date: Mon, 18 Nov 2019 21:01:39 +0200 Subject: deps: upgrade npm to 6.13.1 PR-URL: https://github.com/nodejs/node/pull/30533 Reviewed-By: Rich Trott Reviewed-By: Ruben Bridgewater Reviewed-By: Jiawen Geng Reviewed-By: Colin Ihrig --- deps/npm/lib/install.js | 8 +++++--- deps/npm/lib/install/fund.js | 4 ++-- deps/npm/lib/utils/funding.js | 18 ++++++++++++------ 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'deps/npm/lib') diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index a4cf2b186d..378ada7b05 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -26,6 +26,7 @@ install.usage = usage( '\nnpm install [<@scope>/]@' + '\nnpm install [<@scope>/]@' + '\nnpm install [<@scope>/]@' + + '\nnpm install @npm:' + '\nnpm install ' + '\nnpm install ' + '\nnpm install ' + @@ -877,9 +878,6 @@ Installer.prototype.printInstalledForHuman = function (diffs, auditResult) { report += ' in ' + ((Date.now() - this.started) / 1000) + 's' output(report) - if (auditResult) { - audit.printInstallReport(auditResult) - } function packages (num) { return num + ' package' + (num > 1 ? 's' : '') @@ -910,6 +908,10 @@ Installer.prototype.printInstalledForHuman = function (diffs, auditResult) { if (printFundingReport.length) { output(printFundingReport) } + + if (auditResult) { + return audit.printInstallReport(auditResult) + } } Installer.prototype.printInstalledForJSON = function (diffs, auditResult) { diff --git a/deps/npm/lib/install/fund.js b/deps/npm/lib/install/fund.js index 55a167a955..809c05b338 100644 --- a/deps/npm/lib/install/fund.js +++ b/deps/npm/lib/install/fund.js @@ -39,8 +39,8 @@ function getPrintFundingReport ({ fund, idealTree }, opts) { return padding('') + length + ' ' + packageQuantity(length) + - ' looking for funding.' + - padding('Run "npm fund" to find out more.') + ' looking for funding' + + padding(' run `npm fund` for details\n') } function getPrintFundingReportJSON ({ fund, idealTree }) { diff --git a/deps/npm/lib/utils/funding.js b/deps/npm/lib/utils/funding.js index 2c994e0b6b..dce4014764 100644 --- a/deps/npm/lib/utils/funding.js +++ b/deps/npm/lib/utils/funding.js @@ -8,12 +8,10 @@ exports.validFundingUrl = validFundingUrl // Is the value of a `funding` property of a `package.json` // a valid type+url for `npm fund` to display? function validFundingUrl (funding) { - if (!funding || !funding.url) { - return false - } + if (!funding) return false try { - var parsed = new URL(funding.url) + var parsed = new URL(funding.url || funding) } catch (error) { return false } @@ -62,6 +60,14 @@ function getFundingInfo (idealTree, opts) { ) } + function retrieveFunding (funding) { + return typeof funding === 'string' + ? { + url: funding + } + : funding + } + function getFundingDependencies (tree) { const deps = tree && tree.dependencies if (!deps) return empty() @@ -82,7 +88,7 @@ function getFundingInfo (idealTree, opts) { } if (funding && validFundingUrl(funding)) { - fundingItem.funding = funding + fundingItem.funding = retrieveFunding(funding) length++ } @@ -134,7 +140,7 @@ function getFundingInfo (idealTree, opts) { } if (idealTree && idealTree.funding) { - result.funding = idealTree.funding + result.funding = retrieveFunding(idealTree.funding) } result.dependencies = -- cgit v1.2.3