Skip to content

Commit

Permalink
deps: upgrade npm to 7.5.1
Browse files Browse the repository at this point in the history
PR-URL: #37177
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
ruyadorno authored and targos committed Feb 2, 2021
1 parent a26dfb3 commit 4551d14
Show file tree
Hide file tree
Showing 104 changed files with 1,027 additions and 198 deletions.
2 changes: 2 additions & 0 deletions deps/npm/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -748,3 +748,5 @@ Jeff Griffiths <jeff@eko-recordings.ca>
Michael Garvin <gar+gh@danger.computer>
Gar <gar+gh@danger.computer>
dr-js <dr@dr.run>
Pavan Bellamkonda <31280326+pavanbellamkonda@users.noreply.github.com>
Alexander Riccio <test35965@gmail.com>
42 changes: 42 additions & 0 deletions deps/npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
## v7.5.1 (2021-02-01

### BUG FIXES

* [`0ea134e41`](https://github.com/npm/cli/commit/0ea134e4190f322138299c51672eab5387ec41bb)
[#2587](https://github.com/npm/cli/issues/2587)
pass all settings through to pacote.packument, fixes #2060
([@nlf](https://github.com/nlf))
* [`8c5ca2f51`](https://github.com/npm/cli/commit/8c5ca2f516f5ac87f3bbd7f1fd95c0b283a21f14)
Add test for npm-usage.js, and fix 'npm --long' output
([@isaacs](https://github.com/isaacs))

### DEPENDENCIES

* [`7e4e88e93`](https://github.com/npm/cli/commit/7e4e88e938323e34a2a41176472d8e43e84bd4dd)
`@npmcli/arborist@2.1.1`, `pacote@11.2.4`
* Properly raise ERESOLVE errors on root dev dependencies
* Ignore ERESOLVE errors when performing git dep 'prepare' scripts
* Always reinstall packages that are explicitly requested
* fix global update all so it actually updates things
* Install bins properly when global root is a link
([@isaacs](https://github.com/isaacs))

### DOCUMENTATION

* [`23dac2fef`](https://github.com/npm/cli/commit/23dac2feff1d02193791c7e39d9e93bc9bf8e624)
[#2557](https://github.com/npm/cli/issues/2557)
npm team revamp
([@ruyadorno](https://github.com/ruyadorno))
* [`dd05ba0c0`](https://github.com/npm/cli/commit/dd05ba0c0b2f4c70eb8558c0ecc54889efbe98f5)
[#2572](https://github.com/npm/cli/issues/2572)
add note about `--force` overriding peer dependencies
([@isaacs](https://github.com/isaacs))
* [`e27639780`](https://github.com/npm/cli/commit/e276397809aceb01cc468e02a83bc6f2265376d9)
[#2584](https://github.com/npm/cli/issues/2584)
Fixed the spelling of contributor as it was written as conributor
([@pavanbellamkonda](https://github.com/pavanbellamkonda))
* [`13a5e3178`](https://github.com/npm/cli/commit/13a5e31781cdaa37d3f007e1c8583c7cb591c62a)
[#2502](https://github.com/npm/cli/issues/2502)
elaborate that npm help uses browser
([@ariccio](https://github.com/ariccio))

## v7.5.0 (2021-01-28)

### FEATURES
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $ cd ./npm && npm install
$ npm run test
```

**5. Open a [Pull Request](https://github.com/npm/cli/pulls) for your work & become the newest conributor to `npm`! 🎉**
**5. Open a [Pull Request](https://github.com/npm/cli/pulls) for your work & become the newest contributor to `npm`! 🎉**

## Test Coverage

Expand Down
68 changes: 56 additions & 12 deletions deps/npm/docs/content/commands/npm-team.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ npm team add <scope:team> <user>
npm team rm <scope:team> <user>

npm team ls <scope>|<scope:team>

npm team edit <scope:team>
```

### Description
Expand All @@ -24,31 +22,76 @@ Used to manage teams in organizations, and change team memberships. Does not
handle permissions for packages.

Teams must always be fully qualified with the organization/scope they belong to
when operating on them, separated by a colon (`:`). That is, if you have a `wombats` team in a `wisdom` organization, you must always refer to that team as `wisdom:wombats` in these commands.
when operating on them, separated by a colon (`:`). That is, if you have a
`newteam` team in an `org` organization, you must always refer to that team
as `@org:newteam` in these commands.

If you have two-factor authentication enabled in `auth-and-writes` mode, then you can provide a code from your authenticator with `[--otp <otpcode>]`. If you don't include this then you will be prompted.
If you have two-factor authentication enabled in `auth-and-writes` mode, then
you can provide a code from your authenticator with `[--otp <otpcode>]`.
If you don't include this then you will be prompted.

* create / destroy:
Create a new team, or destroy an existing one. Note: You cannot remove the `developers` team, <a href="https://docs.npmjs.com/about-developers-team" target="_blank">learn more.</a>
* add / rm:
Add a user to an existing team, or remove a user from a team they belong to.
Create a new team, or destroy an existing one. Note: You cannot remove the
`developers` team, <a href="https://docs.npmjs.com/about-developers-team" target="_blank">learn more.</a>

Here's how to create a new team `newteam` under the `org` org:

```bash
npm team create @org:newteam
```

You should see a confirming message such as: `+@org:newteam` once the new
team has been created.

* add:
Add a user to an existing team.

Adding a new user `username` to a team named `newteam` under the `org` org:

```bash
npm team add @org:newteam username
```

On success, you should see a message: `username added to @org:newteam`

* rm:
Using `npm team rm` you can also remove users from a team they belong to.

Here's an example removing user `username` from `newteam` team
in `org` organization:
```bash
npm team rm @org:newteam username
```
Once the user is removed a confirmation message is displayed:
`username removed from @org:newteam`
* ls:
If performed on an organization name, will return a list of existing teams
under that organization. If performed on a team, it will instead return a list
of all users belonging to that particular team.
* edit:
Edit a current team.
Here's an example of how to list all teams from an org named `org`:

```bash
npm team ls @org
```

Example listing all members of a team named `newteam`:

```bash
npm team ls @org:newteam
```

### Details

`npm team` always operates directly on the current registry, configurable from
the command line using `--registry=<registry url>`.

In order to create teams and manage team membership, you must be a *team admin*
under the given organization. Listing teams and team memberships may be done by
any member of the organizations.
You must be a *team admin* to create teams and manage team membership, under
the given organization. Listing teams and team memberships may be done by
any member of the organization.

Organization creation and management of team admins and *organization* members
is done through the website, not the npm CLI.
Expand All @@ -59,4 +102,5 @@ use the `npm access` command to grant or revoke the appropriate permissions.
### See Also

* [npm access](/commands/npm-access)
* [npm config](/commands/npm-config)
* [npm registry](/using-npm/registry)
1 change: 1 addition & 0 deletions deps/npm/docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ mistakes, unnecessary performance degradation, and malicious input.
range (including SemVer-major changes).
* Allow a module to be installed as a direct dependency of itself.
* Allow unpublishing all versions of a published package.
* Allow conflicting peerDependencies to be installed in the root project.

If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Original file line number Diff line number Diff line change
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.5.0 /path/to/npm
<pre lang="bash"><code>npm@7.5.1 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
53 changes: 39 additions & 14 deletions deps/npm/docs/output/commands/npm-team.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,48 +152,73 @@ <h2 id="table-of-contents">Table of contents</h2>
npm team rm &lt;scope:team&gt; &lt;user&gt;

npm team ls &lt;scope&gt;|&lt;scope:team&gt;

npm team edit &lt;scope:team&gt;
</code></pre>
<h3 id="description">Description</h3>
<p>Used to manage teams in organizations, and change team memberships. Does not
handle permissions for packages.</p>
<p>Teams must always be fully qualified with the organization/scope they belong to
when operating on them, separated by a colon (<code>:</code>). That is, if you have a <code>wombats</code> team in a <code>wisdom</code> organization, you must always refer to that team as <code>wisdom:wombats</code> in these commands.</p>
<p>If you have two-factor authentication enabled in <code>auth-and-writes</code> mode, then you can provide a code from your authenticator with <code>[--otp &lt;otpcode&gt;]</code>. If you don’t include this then you will be prompted.</p>
when operating on them, separated by a colon (<code>:</code>). That is, if you have a
<code>newteam</code> team in an <code>org</code> organization, you must always refer to that team
as <code>@org:newteam</code> in these commands.</p>
<p>If you have two-factor authentication enabled in <code>auth-and-writes</code> mode, then
you can provide a code from your authenticator with <code>[--otp &lt;otpcode&gt;]</code>.
If you don’t include this then you will be prompted.</p>
<ul>
<li>
<p>create / destroy:
Create a new team, or destroy an existing one. Note: You cannot remove the <code>developers</code> team, <!-- raw HTML omitted -->learn more.<!-- raw HTML omitted --></p>
Create a new team, or destroy an existing one. Note: You cannot remove the
<code>developers</code> team, <!-- raw HTML omitted -->learn more.<!-- raw HTML omitted --></p>
<p>Here’s how to create a new team <code>newteam</code> under the <code>org</code> org:</p>
<pre lang="bash"><code>npm team create @org:newteam
</code></pre>
<p>You should see a confirming message such as: <code>+@org:newteam</code> once the new
team has been created.</p>
</li>
<li>
<p>add:
Add a user to an existing team.</p>
<p>Adding a new user <code>username</code> to a team named <code>newteam</code> under the <code>org</code> org:</p>
<pre lang="bash"><code>npm team add @org:newteam username
</code></pre>
<p>On success, you should see a message: <code>username added to @org:newteam</code></p>
</li>
<li>
<p>add / rm:
Add a user to an existing team, or remove a user from a team they belong to.</p>
<p>rm:
Using <code>npm team rm</code> you can also remove users from a team they belong to.</p>
<p>Here’s an example removing user <code>username</code> from <code>newteam</code> team
in <code>org</code> organization:</p>
<pre lang="bash"><code>npm team rm @org:newteam username
</code></pre>
<p>Once the user is removed a confirmation message is displayed:
<code>username removed from @org:newteam</code></p>
</li>
<li>
<p>ls:
If performed on an organization name, will return a list of existing teams
under that organization. If performed on a team, it will instead return a list
of all users belonging to that particular team.</p>
</li>
<li>
<p>edit:
Edit a current team.</p>
<p>Here’s an example of how to list all teams from an org named <code>org</code>:</p>
<pre lang="bash"><code>npm team ls @org
</code></pre>
<p>Example listing all members of a team named <code>newteam</code>:</p>
<pre lang="bash"><code>npm team ls @org:newteam
</code></pre>
</li>
</ul>
<h3 id="details">Details</h3>
<p><code>npm team</code> always operates directly on the current registry, configurable from
the command line using <code>--registry=&lt;registry url&gt;</code>.</p>
<p>In order to create teams and manage team membership, you must be a <em>team admin</em>
under the given organization. Listing teams and team memberships may be done by
any member of the organizations.</p>
<p>You must be a <em>team admin</em> to create teams and manage team membership, under
the given organization. Listing teams and team memberships may be done by
any member of the organization.</p>
<p>Organization creation and management of team admins and <em>organization</em> members
is done through the website, not the npm CLI.</p>
<p>To use teams to manage permissions on packages belonging to your organization,
use the <code>npm access</code> command to grant or revoke the appropriate permissions.</p>
<h3 id="see-also">See Also</h3>
<ul>
<li><a href="../commands/npm-access.html">npm access</a></li>
<li><a href="../commands/npm-config.html">npm config</a></li>
<li><a href="../using-npm/registry.html">npm registry</a></li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Original file line number Diff line number Diff line change
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.5.0</p>
<p>7.5.1</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
1 change: 1 addition & 0 deletions deps/npm/docs/output/using-npm/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ <h4 id="force">force</h4>
range (including SemVer-major changes).</li>
<li>Allow a module to be installed as a direct dependency of itself.</li>
<li>Allow unpublishing all versions of a published package.</li>
<li>Allow conflicting peerDependencies to be installed in the root project.</li>
</ul>
<p>If you don’t have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
Expand Down
3 changes: 1 addition & 2 deletions deps/npm/lib/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const output = require('./utils/output.js')
const otplease = require('./utils/otplease.js')
const usageUtil = require('./utils/usage.js')
const getIdentity = require('./utils/get-identity.js')
const { prefix } = npm

const usage = usageUtil(
'npm access',
Expand Down Expand Up @@ -165,7 +164,7 @@ const getPackage = async (name, requireScope) => {
return name.trim()
else {
try {
const pkg = await readPackageJson(path.resolve(prefix, 'package.json'))
const pkg = await readPackageJson(path.resolve(npm.prefix, 'package.json'))
name = pkg.name
} catch (err) {
if (err.code === 'ENOENT') {
Expand Down
14 changes: 13 additions & 1 deletion deps/npm/lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const Arborist = require('@npmcli/arborist')
const rimraf = util.promisify(require('rimraf'))
const reifyFinish = require('./utils/reify-finish.js')
const runScript = require('@npmcli/run-script')
const fs = require('fs')
const readdir = util.promisify(fs.readdir)

const log = require('npmlog')
const npm = require('./npm.js')
Expand All @@ -13,6 +15,16 @@ const completion = require('./utils/completion/none.js')

const cmd = (args, cb) => ci().then(() => cb()).catch(cb)

const removeNodeModules = async where => {
const rimrafOpts = { glob: false }
process.emit('time', 'npm-ci:rm')
const path = `${where}/node_modules`
// get the list of entries so we can skip the glob for performance
const entries = await readdir(path, null).catch(er => [])
await Promise.all(entries.map(f => rimraf(`${path}/${f}`, rimrafOpts)))
process.emit('timeEnd', 'npm-ci:rm')
}

const ci = async () => {
if (npm.flatOptions.global) {
const err = new Error('`npm ci` does not work for global packages')
Expand All @@ -33,7 +45,7 @@ const ci = async () => {
'later to generate a package-lock.json file, then try again.'
throw new Error(msg)
}),
rimraf(`${where}/node_modules/*`, { glob: { dot: true, nosort: true, silent: true } }),
removeNodeModules(where),
])
// npm ci should never modify the lockfile or package.json
await arb.reify({ ...npm.flatOptions, save: false })
Expand Down
3 changes: 1 addition & 2 deletions deps/npm/lib/help-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,11 @@ const searchFiles = async (args, data, files) => {

// coverage is ignored here because the contents of results are
// nondeterministic due to either glob or readFiles or Object.entries
return results.sort((a, b) =>
return results.sort(/* istanbul ignore next */ (a, b) =>
a.found.length > b.found.length ? -1
: a.found.length < b.found.length ? 1
: a.totalHits > b.totalHits ? -1
: a.totalHits < b.totalHits ? 1
/* istanbul ignore next */
: a.lines.length > b.lines.length ? -1
: a.lines.length < b.lines.length ? 1
: 0).slice(0, 10)
Expand Down
1 change: 1 addition & 0 deletions deps/npm/lib/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async function outdated_ (tree, deps, opts) {

async function getPackument (spec) {
const packument = await pacote.packument(spec, {
...npm.flatOptions,
fullMetadata: npm.flatOptions.long,
preferOnline: true,
})
Expand Down
10 changes: 3 additions & 7 deletions deps/npm/lib/utils/ansi-trim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
function ansiTrim (str) {
var r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g')
return str.replace(r, '')
}

module.exports = ansiTrim
const r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g')
module.exports = str => str.replace(r, '')
Loading

0 comments on commit 4551d14

Please sign in to comment.