Skip to content

Commit

Permalink
deps: upgrade npm to 7.13.0
Browse files Browse the repository at this point in the history
PR-URL: #38682
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
ruyadorno authored and Trott committed May 15, 2021
1 parent d7bf2e0 commit 4a22850
Show file tree
Hide file tree
Showing 28 changed files with 846 additions and 99 deletions.
18 changes: 18 additions & 0 deletions deps/npm/CHANGELOG.md
@@ -1,3 +1,21 @@
## v7.13.0 (2021-05-13)

* [`076420c14`](https://github.com/npm/cli/commit/076420c149d097056f687e44e21744b743b86e4e)
[#3231](https://github.com/npm/cli/issues/3231)
feat(publish): add workspace support
([@wraithgar](https://github.com/wraithgar))
* [`370b36a36`](https://github.com/npm/cli/commit/370b36a36ca226840761e4214cbccaf2a1a90e3c)
[#3241](https://github.com/npm/cli/issues/3241)
feat(fund): add workspaces support
([@ruyadorno](https://github.com/ruyadorno))

### DEPENDENCIES

* [`0c18e4f77`](https://github.com/npm/cli/commit/0c18e4f774562fa054fedf323bea25805ebf39b3)
`@npmcli/arborist@2.5.0`
* [`b551c6811`](https://github.com/npm/cli/commit/b551c6811251dbc901f47fea3c137f93e205a9e4)
`libnpmfund@1.1.0`

## v7.12.1 (2021-05-10)

### BUG FIXES
Expand Down
56 changes: 56 additions & 0 deletions deps/npm/docs/content/commands/npm-fund.md
Expand Up @@ -8,6 +8,7 @@ description: Retrieve funding information

```bash
npm fund [<pkg>]
npm fund [-w <workspace-name>]
```

### Description
Expand All @@ -24,6 +25,43 @@ The list will avoid duplicated entries and will stack all packages that
share the same url as a single entry. Thus, the list does not have the same
shape of the output from `npm ls`.

#### Example

### Workspaces support

It's possible to filter the results to only include a single workspace and its
dependencies using the `workspace` config option.

#### Example:

Here's an example running `npm fund` in a project with a configured
workspace `a`:

```bash
$ npm fund
test-workspaces-fund@1.0.0
+-- https://example.com/a
| | `-- a@1.0.0
| `-- https://example.com/maintainer
| `-- foo@1.0.0
+-- https://example.com/npmcli-funding
| `-- @npmcli/test-funding
`-- https://example.com/org
`-- bar@2.0.0
```

And here is an example of the expected result when filtering only by
a specific workspace `a` in the same project:

```bash
$ npm fund -w a
test-workspaces-fund@1.0.0
`-- https://example.com/a
| `-- a@1.0.0
`-- https://example.com/maintainer
`-- foo@2.0.0
```

### Configuration

#### browser
Expand All @@ -48,6 +86,23 @@ Show information in JSON format.
Whether to represent the tree structure using unicode characters.
Set it to `false` in order to use all-ansi output.

#### `workspace`

* Default:
* Type: String (can be set multiple times)

Enable running a command in the context of the configured workspaces of the
current project while filtering by running only the workspaces defined by
this configuration option.

Valid values for the `workspace` config are either:
* Workspace names
* Path to a workspace directory
* Path to a parent workspace directory (will result to selecting all of the
nested workspaces)

This value is not exported to the environment for child processes.

#### which

* Type: Number
Expand All @@ -61,3 +116,4 @@ If there are multiple funding sources, which 1-indexed source URL to open.
* [npm docs](/commands/npm-docs)
* [npm ls](/commands/npm-ls)
* [npm config](/commands/npm-config)
* [npm workspaces](/using-npm/workspaces)
7 changes: 7 additions & 0 deletions deps/npm/docs/content/commands/npm-publish.md
Expand Up @@ -47,6 +47,13 @@ by specifying a different default registry or using a
actually publishing to the registry. Reports the details of what would
have been published.
* `[--workspaces]`: Enables workspace context while publishing. All
workspace packages will be published.
* `[--workspace]`: Enables workspaces context and limits results to only
those specified by this config item. Only the packages in the
workspaces given will be published.
The publish will fail if the package name and version combination already
exists in the specified registry.
Expand Down
45 changes: 45 additions & 0 deletions deps/npm/docs/output/commands/npm-fund.html
Expand Up @@ -146,6 +146,7 @@ <h2 id="table-of-contents">Table of contents</h2>

<div id="_content"><h3 id="synopsis">Synopsis</h3>
<pre lang="bash"><code>npm fund [&lt;pkg&gt;]
npm fund [-w &lt;workspace-name&gt;]
</code></pre>
<h3 id="description">Description</h3>
<p>This command retrieves information on how to fund the dependencies of a
Expand All @@ -158,6 +159,33 @@ <h3 id="description">Description</h3>
<p>The list will avoid duplicated entries and will stack all packages that
share the same url as a single entry. Thus, the list does not have the same
shape of the output from <code>npm ls</code>.</p>
<h4 id="example">Example</h4>
<h3 id="workspaces-support">Workspaces support</h3>
<p>It’s possible to filter the results to only include a single workspace and its
dependencies using the <code>workspace</code> config option.</p>
<h4 id="example2">Example:</h4>
<p>Here’s an example running <code>npm fund</code> in a project with a configured
workspace <code>a</code>:</p>
<pre lang="bash"><code>$ npm fund
test-workspaces-fund@1.0.0
+-- https://example.com/a
| | `-- a@1.0.0
| `-- https://example.com/maintainer
| `-- foo@1.0.0
+-- https://example.com/npmcli-funding
| `-- @npmcli/test-funding
`-- https://example.com/org
`-- bar@2.0.0
</code></pre>
<p>And here is an example of the expected result when filtering only by
a specific workspace <code>a</code> in the same project:</p>
<pre lang="bash"><code>$ npm fund -w a
test-workspaces-fund@1.0.0
`-- https://example.com/a
| `-- a@1.0.0
`-- https://example.com/maintainer
`-- foo@2.0.0
</code></pre>
<h3 id="configuration">Configuration</h3>
<h4 id="browser">browser</h4>
<ul>
Expand All @@ -178,6 +206,22 @@ <h4 id="unicode">unicode</h4>
</ul>
<p>Whether to represent the tree structure using unicode characters.
Set it to <code>false</code> in order to use all-ansi output.</p>
<h4 id="workspace"><code>workspace</code></h4>
<ul>
<li>Default:</li>
<li>Type: String (can be set multiple times)</li>
</ul>
<p>Enable running a command in the context of the configured workspaces of the
current project while filtering by running only the workspaces defined by
this configuration option.</p>
<p>Valid values for the <code>workspace</code> config are either:</p>
<ul>
<li>Workspace names</li>
<li>Path to a workspace directory</li>
<li>Path to a parent workspace directory (will result to selecting all of the
nested workspaces)</li>
</ul>
<p>This value is not exported to the environment for child processes.</p>
<h4 id="which">which</h4>
<ul>
<li>Type: Number</li>
Expand All @@ -190,6 +234,7 @@ <h2 id="see-also">See Also</h2>
<li><a href="../commands/npm-docs.html">npm docs</a></li>
<li><a href="../commands/npm-ls.html">npm ls</a></li>
<li><a href="../commands/npm-config.html">npm config</a></li>
<li><a href="../using-npm/workspaces.html">npm workspaces</a></li>
</ul>
</div>

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Expand Up @@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
<pre lang="bash"><code>npm@7.12.1 /path/to/npm
<pre lang="bash"><code>npm@7.13.0 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
9 changes: 9 additions & 0 deletions deps/npm/docs/output/commands/npm-publish.html
Expand Up @@ -188,6 +188,15 @@ <h3 id="description">Description</h3>
actually publishing to the registry. Reports the details of what would
have been published.</p>
</li>
<li>
<p><code>[--workspaces]</code>: Enables workspace context while publishing. All
workspace packages will be published.</p>
</li>
<li>
<p><code>[--workspace]</code>: Enables workspaces context and limits results to only
those specified by this config item. Only the packages in the
workspaces given will be published.</p>
</li>
</ul>
<p>The publish will fail if the package name and version combination already
exists in the specified registry.</p>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Expand Up @@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>7.12.1</p>
<p>7.13.0</p>
<h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
Expand Down
16 changes: 11 additions & 5 deletions deps/npm/lib/fund.js
Expand Up @@ -13,15 +13,14 @@ const {

const completion = require('./utils/completion/installed-deep.js')
const openUrl = require('./utils/open-url.js')
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')

const getPrintableName = ({ name, version }) => {
const printableVersion = version ? `@${version}` : ''
return `${name}${printableVersion}`
}

const BaseCommand = require('./base-command.js')

class Fund extends BaseCommand {
class Fund extends ArboristWorkspaceCmd {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get description () {
return 'Retrieve funding information'
Expand All @@ -38,6 +37,7 @@ class Fund extends BaseCommand {
'json',
'browser',
'unicode',
'workspace',
'which',
]
}
Expand Down Expand Up @@ -92,10 +92,16 @@ class Fund extends BaseCommand {
return
}

const fundingInfo = getFundingInfo(tree, {
...this.flatOptions,
log: this.npm.log,
workspaces: this.workspaces,
})

if (this.npm.config.get('json'))
this.npm.output(this.printJSON(getFundingInfo(tree)))
this.npm.output(this.printJSON(fundingInfo))
else
this.npm.output(this.printHuman(getFundingInfo(tree)))
this.npm.output(this.printHuman(fundingInfo))
}

printJSON (fundingInfo) {
Expand Down

0 comments on commit 4a22850

Please sign in to comment.