Skip to content

Commit 3ddcad5

Browse files
committed
deps: upgrade npm to 7.0.0
PR-URL: #35631 Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent ac5df63 commit 3ddcad5

File tree

156 files changed

+3031
-7563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+3031
-7563
lines changed

deps/npm/CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
## v7.0.0 (2020-10-12)
2+
3+
### BUG FIXES
4+
5+
* [`7bcdb3636`](https://github.com/npm/cli/commit/7bcdb3636e29291b9c722fe03a8450859dcb5b4f)
6+
[#1949](https://github.com/npm/cli/pull/1949) fix: ensure `publishConfig`
7+
is passed through ([@nlf](https://github.com/nlf))
8+
* [`97978462e`](https://github.com/npm/cli/commit/97978462e9050261e4ce2549e71fe94a48796577)
9+
fix: patch `config.js` to remove duplicate vals
10+
([@darcyclarke](https://github.com/darcyclarke))
11+
12+
### DOCUMENTION
13+
14+
* [`60769d757`](https://github.com/npm/cli/commit/60769d757859c88e2cceab66975f182a47822816)
15+
[#1911](https://github.com/npm/cli/pull/1911) docs: v7 npm-install
16+
refresh ([@ruyadorno](https://github.com/ruyadorno))
17+
* [`08de49042`](https://github.com/npm/cli/commit/08de4904255742cbf7477a20bdeebe82f283a406)
18+
[#1938](https://github.com/npm/cli/pull/1938) docs: v7 using npm config
19+
updates ([@ruyadorno](https://github.com/ruyadorno))
20+
21+
### DEPENDENCIES
22+
23+
* [`15366a1cf`](https://github.com/npm/cli/commit/15366a1cf0073327b90ac7eb977ff8a73b52cc62)
24+
`npm-registry-fetch@8.1.5`
25+
* [`f04a74140`](https://github.com/npm/cli/commit/f04a74140bf65db36be3c379e0eb20dd6db3cc5c)
26+
`init-package-json@2.0.0`
27+
* [`1de21dce0`](https://github.com/npm/cli/commit/1de21dce0e56874203a789ce33124a4fc4d3b15f)
28+
fix: support dot-separated aliases defined in a `.npmrc` ini files
29+
for `init-*` configs ([@ruyadorno](https://github.com/ruyadorno))
30+
* [`a67275cd9`](https://github.com/npm/cli/commit/a67275cd9a75fa05ee3d3265832d0a015b14e81c)
31+
`eslint@7.11.0`
32+
* [`6fb83b78d`](https://github.com/npm/cli/commit/6fb83b78db09adfafd7cbd4b926e77802c4993e4)
33+
`hosted-git-info@3.0.6`
34+
* [`1ca30cc9b`](https://github.com/npm/cli/commit/1ca30cc9b8e7edc2043c1f848855f19781729dc9)
35+
`libnpmfund@1.0.0`
36+
* [`28a2d2ba4`](https://github.com/npm/cli/commit/28a2d2ba4a63808614f5d98685a64531e3198b93)
37+
`@npmcli/arborist@1.0.0`
38+
* [npm/rfcs#239](https://github.com/npm/rfcs/pull/239) Improve handling
39+
of conflicting `peerDependencies` in transitive dependencies, so that
40+
`--force` will always accept a best effort override, and
41+
`--strict-peer-deps` will fail faster on conflicts.
42+
* [`9306c6833`](https://github.com/npm/cli/commit/9306c6833e2e77675e0cfddd569b6b54a8bcf172)
43+
`libnpmfund@1.0.1`
44+
* [`fafb348ef`](https://github.com/npm/cli/commit/fafb348ef976116d47ada238beb258d5db5758a7)
45+
`npm-package-arg@8.1.0`
46+
* [`365f2e756`](https://github.com/npm/cli/commit/365f2e7565d0cfde858a43d894a77fb3c6338bb7)
47+
`read-package-json@3.0.0`
48+
149
## v7.0.0-rc.4 (2020-10-09)
250

351
* [`09b456f2d`](https://github.com/npm/cli/commit/09b456f2d776e2757956d2b9869febd1e01a1076)

deps/npm/docs/content/cli-commands/npm-install.md

Lines changed: 64 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@ common options: [-P|--save-prod|-D|--save-dev|-O|--save-optional] [-E|--save-exa
2929

3030
### Description
3131

32-
This command installs a package, and any packages that it depends on. If the
33-
package has a package-lock or shrinkwrap file, the installation of dependencies
34-
will be driven by that, with an `npm-shrinkwrap.json` taking precedence if both
35-
files exist. See [package-lock.json](/configuring-npm/package-lock-json) and [`npm shrinkwrap`](/cli-commands/shrinkwrap).
32+
This command installs a package and any packages that it depends on. If the
33+
package has a package-lock, or an npm shrinkwrap file, or a yarn lock file, the
34+
installation of dependencies will be driven by that, respecting the following
35+
order of precedence:
36+
37+
* `node_modules/.package-lock.json`
38+
* `npm-shrinkwrap.json`
39+
* `package-lock.json`
40+
* `yarn.lock`
41+
42+
See [package-lock.json](/configuring-npm/package-lock-json) and [`npm shrinkwrap`](/cli-commands/shrinkwrap).
3643

3744
A `package` is:
3845

@@ -50,9 +57,9 @@ perhaps if you also want to be able to easily install it elsewhere
5057
after packing it up into a tarball (b).
5158

5259

53-
* `npm install` (in package directory, no arguments):
60+
* `npm install` (in a package directory, no arguments):
5461

55-
Install the dependencies in the local node_modules folder.
62+
Install the dependencies in the local `node_modules` folder.
5663

5764
In global mode (ie, with `-g` or `--global` appended to the command),
5865
it installs the current package context (ie, the current working
@@ -75,13 +82,13 @@ after packing it up into a tarball (b).
7582
Install the package in the directory as a symlink in the current project.
7683
Its dependencies will be installed before it's linked. If `<folder>` sits
7784
inside the root of your project, its dependencies may be hoisted to the
78-
toplevel `node_modules` as they would for other types of dependencies.
85+
top-level `node_modules` as they would for other types of dependencies.
7986

8087
* `npm install <tarball file>`:
8188

8289
Install a package that is sitting on the filesystem. Note: if you just want
8390
to link a dev directory into your npm root, you can do this more easily by
84-
using `npm link`.
91+
using [`npm link`](/cli-commands/npm-link).
8592

8693
Tarball requirements:
8794
* The filename *must* use `.tar`, `.tar.gz`, or `.tgz` as
@@ -114,24 +121,6 @@ after packing it up into a tarball (b).
114121

115122
npm install sax
116123

117-
* `npm install <alias>@npm:<name>`:
118-
119-
Install a package under a custom alias. Allows multiple versions of
120-
a same-name package side-by-side, more convenient import names for
121-
packages with otherwise long ones and using git forks replacements
122-
or forked npm packages as replacements. Aliasing works only on your
123-
project and does not rename packages in transitive dependencies.
124-
Aliases should follow the naming conventions stated in
125-
[`validate-npm-package-name`](https://www.npmjs.com/package/validate-npm-package-name#naming-rules).
126-
127-
Examples:
128-
129-
npm install my-react@npm:react
130-
npm install jquery2@npm:jquery@2
131-
npm install jquery3@npm:jquery@3
132-
npm install npa@npm:npm-package-arg
133-
134-
135124
`npm install` saves any specified packages into `dependencies` by default.
136125
Additionally, you can control where and how they get saved with some
137126
additional flags:
@@ -181,6 +170,24 @@ after packing it up into a tarball (b).
181170
working directory, then it will try to install that, and only try to
182171
fetch the package by name if it is not valid.
183172

173+
* `npm install <alias>@npm:<name>`:
174+
175+
Install a package under a custom alias. Allows multiple versions of
176+
a same-name package side-by-side, more convenient import names for
177+
packages with otherwise long ones, and using git forks replacements
178+
or forked npm packages as replacements. Aliasing works only on your
179+
project and does not rename packages in transitive dependencies.
180+
Aliases should follow the naming conventions stated in
181+
[`validate-npm-package-name`](https://www.npmjs.com/package/validate-npm-package-name#naming-rules).
182+
183+
Examples:
184+
185+
npm install my-react@npm:react
186+
npm install jquery2@npm:jquery@2
187+
npm install jquery3@npm:jquery@3
188+
npm install npa@npm:npm-package-arg
189+
190+
184191
* `npm install [<@scope>/]<name>@<tag>`:
185192

186193
Install the version of the package that is referenced by the specified tag.
@@ -217,7 +224,7 @@ after packing it up into a tarball (b).
217224
Example:
218225
```bash
219226
npm install sax@">=0.1.0 <0.2.0"
220-
npm install @myorg/privatepackage@">=0.1.0 <0.2.0"
227+
npm install @myorg/privatepackage@"16 - 17"
221228
```
222229

223230
* `npm install <git remote url>`:
@@ -263,6 +270,7 @@ after packing it up into a tarball (b).
263270
264271
```bash
265272
npm install git+ssh://git@github.com:npm/cli.git#v1.0.27
273+
npm install git+ssh://git@github.com:npm/cli#pull/273
266274
npm install git+ssh://git@github.com:npm/cli#semver:^5.0
267275
npm install git+https://isaacs@github.com/npm/cli.git
268276
npm install git://github.com/npm/cli.git#v1.0.27
@@ -283,7 +291,7 @@ after packing it up into a tarball (b).
283291
specified, then `master` is used.
284292
285293
As with regular git dependencies, `dependencies` and `devDependencies` will
286-
be installed if the package has a `prepare` script, before the package is
294+
be installed if the package has a `prepare` script before the package is
287295
done installing.
288296
289297
Examples:
@@ -300,7 +308,7 @@ after packing it up into a tarball (b).
300308
optional and will not be saved in `package.json`.
301309
302310
As with regular git dependencies, `dependencies` and `devDependencies` will
303-
be installed if the package has a `prepare` script, before the package is
311+
be installed if the package has a `prepare` script before the package is
304312
done installing.
305313
306314
Example:
@@ -322,7 +330,7 @@ after packing it up into a tarball (b).
322330
specified, then `master` is used.
323331
324332
As with regular git dependencies, `dependencies` and `devDependencies` will
325-
be installed if the package has a `prepare` script, before the package is
333+
be installed if the package has a `prepare` script before the package is
326334
done installing.
327335
328336
Example:
@@ -344,7 +352,7 @@ after packing it up into a tarball (b).
344352
specified, then `master` is used.
345353
346354
As with regular git dependencies, `dependencies` and `devDependencies` will
347-
be installed if the package has a `prepare` script, before the package is
355+
be installed if the package has a `prepare` script before the package is
348356
done installing.
349357
350358
Example:
@@ -354,7 +362,7 @@ after packing it up into a tarball (b).
354362
npm install gitlab:myusr/myproj#semver:^5.0
355363
```
356364
357-
You may combine multiple arguments, and even multiple types of arguments.
365+
You may combine multiple arguments and even multiple types of arguments.
358366
For example:
359367
360368
```bash
@@ -378,10 +386,6 @@ local copy exists on disk.
378386
npm install sax --force
379387
```
380388
381-
The `--no-fund` argument will hide the message displayed at the end of each
382-
install that acknowledges the number of dependencies looking for funding.
383-
See `npm-fund(1)`
384-
385389
The `-g` or `--global` argument will cause npm to install the package globally
386390
rather than locally. See [folders](/configuring-npm/folders).
387391
@@ -398,17 +402,29 @@ The `--legacy-bundling` argument will cause npm to install the package such
398402
that versions of npm prior to 1.4, such as the one included with node 0.8,
399403
can install the package. This eliminates all automatic deduping.
400404
405+
The `--legacy-peer-deps` argument will cause npm to ignore all
406+
`peerDependencies` when installing, similar to npm@6 and older.
407+
401408
The `--link` argument will cause npm to link global installs into the
402-
local space in some cases.
409+
local space whenever packages from the global space may satisfy a dependency
410+
required version.
411+
412+
The `--no-audit` argument can be used to disable sending audit reports to
413+
the configured registries. See [`npm-audit`](npm-audit) for details on what
414+
is sent.
403415
404416
The `--no-bin-links` argument will prevent npm from creating symlinks for
405417
any binaries the package might contain.
406418
419+
The `--no-fund` argument will hide the message displayed at the end of each
420+
install that acknowledges the number of dependencies looking for funding.
421+
See [`npm-fund`](/cli-commands/npm-fund)
422+
407423
The `--no-optional` argument will prevent optional dependencies from
408424
being installed.
409425
410426
The `--no-shrinkwrap` argument, which will ignore an available
411-
package lock or shrinkwrap file and use the package.json instead.
427+
package-lock or shrinkwrap file and use the package.json instead.
412428
413429
The `--no-package-lock` argument will prevent npm from creating a
414430
`package-lock.json` file. When running with package-lock's disabled npm
@@ -418,32 +434,20 @@ The `--nodedir=/path/to/node/source` argument will allow npm to find the
418434
node source code so that npm can compile native modules.
419435
420436
The `--only={prod[uction]|dev[elopment]}` argument will cause either only
421-
`devDependencies` or only non-`devDependencies` to be installed regardless of the `NODE_ENV`.
437+
`devDependencies` or only non-`devDependencies` to be installed regardless
438+
of the `NODE_ENV`.
422439
423-
The `--no-audit` argument can be used to disable sending of audit reports to
424-
the configured registries. See [`npm-audit`](npm-audit) for details on what is sent.
440+
The `--strict-peer-deps` argument will cause the install to fail on any
441+
`peerDependencies` conflict, even if it's possible to use a heuristic to
442+
provide a least-surprising resolution to a given conflict.
425443
426444
See [`config`](/using-npm/config). Many of the configuration params have some
427445
effect on installation, since that's most of what npm does.
428446
429447
#### Algorithm
430448
431-
To install a package, npm uses the following algorithm:
432-
```bash
433-
load the existing node_modules tree from disk
434-
clone the tree
435-
fetch the package.json and assorted metadata and add it to the clone
436-
walk the clone and add any missing dependencies
437-
dependencies will be added as close to the top as is possible
438-
without breaking any other modules
439-
compare the original tree with the cloned tree and make a list of
440-
actions to take to convert one to the other
441-
execute all of the actions, deepest first
442-
kinds of actions are install, update, remove and move
443-
```
444-
445-
For this `package{dep}` structure: `A{B,C}, B{C}, C{D}`,
446-
this algorithm produces:
449+
Given a `package{dep}` structure: `A{B,C}, B{C}, C{D}`,
450+
the npm install algorithm produces:
447451
448452
```bash
449453
A
@@ -466,39 +470,13 @@ A
466470
+-- D@1
467471
```
468472
469-
Because B's D@1 will be installed in the top level, C now has to install D@2
473+
Because B's D@1 will be installed in the top-level, C now has to install D@2
470474
privately for itself. This algorithm is deterministic, but different trees may
471475
be produced if two dependencies are requested for installation in a different
472476
order.
473477
474-
See [folders](/configuring-npm/folders) for a more detailed description of the specific folder structures that npm creates.
475-
476-
### Limitations of npm's Install Algorithm
477-
478-
npm will refuse to install any package with an identical name to the
479-
current package. This can be overridden with the `--force` flag, but in
480-
most cases can simply be addressed by changing the local package name.
481-
482-
There are some very rare and pathological edge-cases where a cycle can
483-
cause npm to try to install a never-ending tree of packages. Here is
484-
the simplest case:
485-
486-
```bash
487-
A -> B -> A' -> B' -> A -> B -> A' -> B' -> A -> ...
488-
```
489-
490-
where `A` is some version of a package, and `A'` is a different version
491-
of the same package. Because `B` depends on a different version of `A`
492-
than the one that is already in the tree, it must install a separate
493-
copy. The same is true of `A'`, which must install `B'`. Because `B'`
494-
depends on the original version of `A`, which has been overridden, the
495-
cycle falls into infinite regress.
496-
497-
To avoid this situation, npm flat-out refuses to install any
498-
`name@version` that is already present anywhere in the tree of package
499-
folder ancestors. A more correct, but more complex, solution would be
500-
to symlink the existing version into the new location. If this ever
501-
affects a real use-case, it will be investigated.
478+
See [folders](/configuring-npm/folders) for a more detailed description of the
479+
specific folder structures that npm creates.
502480
503481
### See Also
504482

0 commit comments

Comments
 (0)