mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
deps: upgrade npm to 8.7.0
PR-URL: https://github.com/nodejs/node/pull/42744 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
1 parent
1a7af6364d
commit
294664e32c
340 files changed
+4926
-6069
No files matched your search
Vendored
+5
-2
@@ -1,7 +1,10 @@
|
||||
[](https://github.com/npm/cli/actions?query=workflow%3A%22Node+CI%22+branch%3Alatest) [](https://coveralls.io/github/npm/cli?branch=latest)
|
||||
|
||||
# npm - a JavaScript package manager
|
||||
|
||||
[](https://npm.im/npm)
|
||||
[](https://npm.im/npm)
|
||||
[](https://github.com/npm/cli/actions/workflows/ci.yml)
|
||||
[](https://github.com/npm/cli/actions/workflows/benchmark.yml)
|
||||
|
||||
### Requirements
|
||||
|
||||
One of the following versions of [Node.js](https://nodejs.org/en/download/) must be installed to run **`npm`**:
|
||||
|
||||
+2
@@ -394,6 +394,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+7
@@ -46,6 +46,13 @@ In short, the main differences between using `npm install` and `npm ci` are:
|
||||
* It will never write to `package.json` or any of the package-locks:
|
||||
installs are essentially frozen.
|
||||
|
||||
NOTE: If you create your `package-lock.json` file by running `npm install`
|
||||
with flags that can affect the shape of your dependency tree, such as
|
||||
`--legacy-peer-deps`, you _must_ provide the same flags to `npm ci` or you
|
||||
are likely to encounter errors. An easy way to do this is to run
|
||||
`npm config set legacy-peer-deps=true --location=project` and commit the
|
||||
`.npmrc` file to your repo.
|
||||
|
||||
### Example
|
||||
|
||||
Make sure you have a package-lock and an up-to-date install:
|
||||
|
||||
+5
-21
@@ -80,11 +80,9 @@ result in new modules being installed.
|
||||
|
||||
Using `npm find-dupes` will run the command in `--dry-run` mode.
|
||||
|
||||
Note that by default `npm dedupe` will not update the semver values of direct
|
||||
dependencies in your project `package.json`, if you want to also update
|
||||
values in `package.json` you can run: `npm dedupe --save` (or add the
|
||||
`save=true` option to a [configuration file](/configuring-npm/npmrc)
|
||||
to make that the default behavior).
|
||||
Note: `npm dedupe` will never update the semver values of direct
|
||||
dependencies in your project `package.json`, if you want to update
|
||||
values in `package.json` you can run: `npm update --save` instead.
|
||||
|
||||
### Configuration
|
||||
|
||||
@@ -158,22 +156,6 @@ This configuration does not affect `npm ci`.
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
#### `save`
|
||||
|
||||
* Default: `true` unless when using `npm update` or `npm dedupe` where it
|
||||
defaults to `false`
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a `package.json` file as dependencies.
|
||||
|
||||
When used with the `npm rm` command, removes the dependency from
|
||||
`package.json`.
|
||||
|
||||
Will also prevent writing to `package-lock.json` if set to `false`.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
#### `omit`
|
||||
|
||||
* Default: 'dev' if the `NODE_ENV` environment variable is set to
|
||||
@@ -323,6 +305,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -335,6 +335,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
@@ -159,6 +159,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -116,6 +116,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -205,6 +205,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
@@ -229,6 +229,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -264,6 +264,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+3
-2
@@ -42,8 +42,7 @@ takes exactly the same arguments as `npm install`.
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
#### `save`
|
||||
|
||||
* Default: `true` unless when using `npm update` or `npm dedupe` where it
|
||||
defaults to `false`
|
||||
* Default: `true` unless when using `npm update` where it defaults to `false`
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a `package.json` file as dependencies.
|
||||
@@ -315,6 +314,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+3
-2
@@ -432,8 +432,7 @@ These are some of the most common options related to installation.
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
#### `save`
|
||||
|
||||
* Default: `true` unless when using `npm update` or `npm dedupe` where it
|
||||
defaults to `false`
|
||||
* Default: `true` unless when using `npm update` where it defaults to `false`
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a `package.json` file as dependencies.
|
||||
@@ -705,6 +704,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+3
-2
@@ -125,8 +125,7 @@ workspace(s).
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
#### `save`
|
||||
|
||||
* Default: `true` unless when using `npm update` or `npm dedupe` where it
|
||||
defaults to `false`
|
||||
* Default: `true` unless when using `npm update` where it defaults to `false`
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a `package.json` file as dependencies.
|
||||
@@ -383,6 +382,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -280,6 +280,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -122,6 +122,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -186,6 +186,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
@@ -157,6 +157,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -103,6 +103,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
@@ -203,6 +203,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
@@ -218,6 +220,8 @@ it's present and fail if the script fails. This is useful, for example, when
|
||||
running scripts that may only apply for some builds in an otherwise generic
|
||||
CI setup.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
@@ -97,6 +97,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+4
-3
@@ -30,7 +30,7 @@ It also removes the package from the `dependencies`, `devDependencies`,
|
||||
`optionalDependencies`, and `peerDependencies` objects in your
|
||||
`package.json`.
|
||||
|
||||
Futher, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm
|
||||
Further, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm
|
||||
will update those files as well.
|
||||
|
||||
`--no-save` will tell npm not to remove the package from your
|
||||
@@ -70,8 +70,7 @@ npm uninstall lodash --no-save
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
#### `save`
|
||||
|
||||
* Default: `true` unless when using `npm update` or `npm dedupe` where it
|
||||
defaults to `false`
|
||||
* Default: `true` unless when using `npm update` where it defaults to `false`
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a `package.json` file as dependencies.
|
||||
@@ -141,6 +140,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+3
-2
@@ -171,8 +171,7 @@ be _downgraded_.
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
#### `save`
|
||||
|
||||
* Default: `true` unless when using `npm update` or `npm dedupe` where it
|
||||
defaults to `false`
|
||||
* Default: `true` unless when using `npm update` where it defaults to `false`
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a `package.json` file as dependencies.
|
||||
@@ -433,6 +432,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
@@ -166,6 +166,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+2
@@ -180,6 +180,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
|
||||
+5
-2
@@ -762,6 +762,8 @@ it's present and fail if the script fails. This is useful, for example, when
|
||||
running scripts that may only apply for some builds in an otherwise generic
|
||||
CI setup.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
@@ -819,6 +821,8 @@ When false, specifying individual workspaces via the `workspace` config, or
|
||||
all workspaces via the `workspaces` flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.
|
||||
|
||||
This value is not exported to the environment for child processes.
|
||||
|
||||
<!-- automatically generated, do not edit manually -->
|
||||
<!-- see lib/utils/config/definitions.js -->
|
||||
|
||||
@@ -1343,8 +1347,7 @@ The base URL of the npm registry.
|
||||
|
||||
#### `save`
|
||||
|
||||
* Default: `true` unless when using `npm update` or `npm dedupe` where it
|
||||
defaults to `false`
|
||||
* Default: `true` unless when using `npm update` where it defaults to `false`
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a `package.json` file as dependencies.
|
||||
|
||||
@@ -439,6 +439,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+6
@@ -179,6 +179,12 @@ before <code>npm ci</code> begins its install.</li>
|
||||
<li>It will never write to <code>package.json</code> or any of the package-locks:
|
||||
installs are essentially frozen.</li>
|
||||
</ul>
|
||||
<p>NOTE: If you create your <code>package-lock.json</code> file by running <code>npm install</code>
|
||||
with flags that can affect the shape of your dependency tree, such as
|
||||
<code>--legacy-peer-deps</code>, you <em>must</em> provide the same flags to <code>npm ci</code> or you
|
||||
are likely to encounter errors. An easy way to do this is to run
|
||||
<code>npm config set legacy-peer-deps=true --location=project</code> and commit the
|
||||
<code>.npmrc</code> file to your repo.</p>
|
||||
<h3 id="example">Example</h3>
|
||||
<p>Make sure you have a package-lock and an up-to-date install:</p>
|
||||
<pre lang="bash"><code>$ cd ./my/npm/project
|
||||
|
||||
+5
-18
@@ -142,7 +142,7 @@ npm command-line interface
|
||||
|
||||
<section id="table_of_contents">
|
||||
<h2 id="table-of-contents">Table of contents</h2>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#global-style"><code>global-style</code></a></li><li><a href="#legacy-bundling"><code>legacy-bundling</code></a></li><li><a href="#strict-peer-deps"><code>strict-peer-deps</code></a></li><li><a href="#package-lock"><code>package-lock</code></a></li><li><a href="#save"><code>save</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#audit"><code>audit</code></a></li><li><a href="#bin-links"><code>bin-links</code></a></li><li><a href="#fund"><code>fund</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#global-style"><code>global-style</code></a></li><li><a href="#legacy-bundling"><code>legacy-bundling</code></a></li><li><a href="#strict-peer-deps"><code>strict-peer-deps</code></a></li><li><a href="#package-lock"><code>package-lock</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#audit"><code>audit</code></a></li><li><a href="#bin-links"><code>bin-links</code></a></li><li><a href="#fund"><code>fund</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
@@ -197,11 +197,9 @@ sufficient.</p>
|
||||
<p>Note that this operation transforms the dependency tree, but will never
|
||||
result in new modules being installed.</p>
|
||||
<p>Using <code>npm find-dupes</code> will run the command in <code>--dry-run</code> mode.</p>
|
||||
<p>Note that by default <code>npm dedupe</code> will not update the semver values of direct
|
||||
dependencies in your project <code>package.json</code>, if you want to also update
|
||||
values in <code>package.json</code> you can run: <code>npm dedupe --save</code> (or add the
|
||||
<code>save=true</code> option to a <a href="../configuring-npm/npmrc.html">configuration file</a>
|
||||
to make that the default behavior).</p>
|
||||
<p>Note: <code>npm dedupe</code> will never update the semver values of direct
|
||||
dependencies in your project <code>package.json</code>, if you want to update
|
||||
values in <code>package.json</code> you can run: <code>npm update --save</code> instead.</p>
|
||||
<h3 id="configuration">Configuration</h3>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
@@ -261,18 +259,6 @@ package-locks disabled use <code>npm prune</code>.</p>
|
||||
<p>This configuration does not affect <code>npm ci</code>.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="save"><code>save</code></h4>
|
||||
<ul>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
|
||||
defaults to <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
|
||||
<p>When used with the <code>npm rm</code> command, removes the dependency from
|
||||
<code>package.json</code>.</p>
|
||||
<p>Will also prevent writing to <code>package-lock.json</code> if set to <code>false</code>.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="omit"><code>omit</code></h4>
|
||||
<ul>
|
||||
<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
|
||||
@@ -394,6 +380,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
@@ -407,6 +407,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
@@ -267,6 +267,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
@@ -233,6 +233,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
@@ -298,6 +298,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
@@ -324,6 +324,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
@@ -348,6 +348,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+2
-2
@@ -174,8 +174,7 @@ takes exactly the same arguments as <code>npm install</code>.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="save"><code>save</code></h4>
|
||||
<ul>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
|
||||
defaults to <code>false</code></li>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
|
||||
@@ -397,6 +396,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+2
-2
@@ -500,8 +500,7 @@ does.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="save"><code>save</code></h4>
|
||||
<ul>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
|
||||
defaults to <code>false</code></li>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
|
||||
@@ -723,6 +722,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+2
-2
@@ -229,8 +229,7 @@ workspace(s).</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="save"><code>save</code></h4>
|
||||
<ul>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
|
||||
defaults to <code>false</code></li>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
|
||||
@@ -440,6 +439,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+2
-1
@@ -166,7 +166,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code>
|
||||
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@8.6.0 /path/to/npm
|
||||
<pre lang="bash"><code>npm@8.7.0 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
</code></pre>
|
||||
@@ -363,6 +363,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
@@ -240,6 +240,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
@@ -288,6 +288,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
@@ -355,6 +355,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
@@ -269,6 +269,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
@@ -222,6 +222,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
@@ -290,6 +290,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="if-present"><code>if-present</code></h4>
|
||||
@@ -303,6 +304,7 @@ This option can be used when it's desirable to optionally run a script when
|
||||
it's present and fail if the script fails. This is useful, for example, when
|
||||
running scripts that may only apply for some builds in an otherwise generic
|
||||
CI setup.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="ignore-scripts"><code>ignore-scripts</code></h4>
|
||||
|
||||
@@ -219,6 +219,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+3
-3
@@ -162,7 +162,7 @@ on its behalf.</p>
|
||||
<p>It also removes the package from the <code>dependencies</code>, <code>devDependencies</code>,
|
||||
<code>optionalDependencies</code>, and <code>peerDependencies</code> objects in your
|
||||
<code>package.json</code>.</p>
|
||||
<p>Futher, if you have an <code>npm-shrinkwrap.json</code> or <code>package-lock.json</code>, npm
|
||||
<p>Further, if you have an <code>npm-shrinkwrap.json</code> or <code>package-lock.json</code>, npm
|
||||
will update those files as well.</p>
|
||||
<p><code>--no-save</code> will tell npm not to remove the package from your
|
||||
<code>package.json</code>, <code>npm-shrinkwrap.json</code>, or <code>package-lock.json</code> files.</p>
|
||||
@@ -189,8 +189,7 @@ it uninstalls the current package context as a global package.
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="save"><code>save</code></h4>
|
||||
<ul>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
|
||||
defaults to <code>false</code></li>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
|
||||
@@ -247,6 +246,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+2
-2
@@ -262,8 +262,7 @@ be <em>downgraded</em>.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="save"><code>save</code></h4>
|
||||
<ul>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
|
||||
defaults to <code>false</code></li>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
|
||||
@@ -476,6 +475,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
@@ -276,6 +276,7 @@ possibly change the workspaces installed to the <code>node_modules</code> folder
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
@@ -270,6 +270,7 @@ other things (test, exec, publish, etc.) will operate on the root project,
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ npm command-line interface
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<h3 id="version">Version</h3>
|
||||
<p>8.6.0</p>
|
||||
<p>8.7.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
|
||||
|
||||
+3
-2
@@ -761,6 +761,7 @@ This option can be used when it's desirable to optionally run a script when
|
||||
it's present and fail if the script fails. This is useful, for example, when
|
||||
running scripts that may only apply for some builds in an otherwise generic
|
||||
CI setup.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="ignore-scripts"><code>ignore-scripts</code></h4>
|
||||
@@ -805,6 +806,7 @@ the order in which omit/include are specified on the command-line.</p>
|
||||
<p>When false, specifying individual workspaces via the <code>workspace</code> config, or
|
||||
all workspaces via the <code>workspaces</code> flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project.</p>
|
||||
<p>This value is not exported to the environment for child processes.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="init-author-email"><code>init-author-email</code></h4>
|
||||
@@ -1223,8 +1225,7 @@ access tokens with the <code>npm token create</code> command.</p>
|
||||
<!-- raw HTML omitted -->
|
||||
<h4 id="save"><code>save</code></h4>
|
||||
<ul>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
|
||||
defaults to <code>false</code></li>
|
||||
<li>Default: <code>true</code> unless when using <code>npm update</code> where it defaults to <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
|
||||
|
||||
Vendored
-2
@@ -36,8 +36,6 @@ function sleep (time) {
|
||||
}
|
||||
|
||||
const login = async (npm, { creds, registry, scope }) => {
|
||||
log.warn('deprecated', 'SSO --auth-type is deprecated')
|
||||
|
||||
const opts = { ...npm.flatOptions, creds, registry, scope }
|
||||
const { ssoType } = opts
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -177,7 +177,7 @@ class Cache extends BaseCommand {
|
||||
async verify () {
|
||||
const cache = path.join(this.npm.cache, '_cacache')
|
||||
const prefix = cache.indexOf(process.env.HOME) === 0
|
||||
? `~${cache.substr(process.env.HOME.length)}`
|
||||
? `~${cache.slice(process.env.HOME.length)}`
|
||||
: cache
|
||||
const stats = await cacache.verify(cache)
|
||||
this.npm.output(`Cache verified and compressed (${prefix})`)
|
||||
|
||||
Vendored
+3
-3
@@ -97,17 +97,17 @@ class Completion extends BaseCommand {
|
||||
const word = words[w]
|
||||
const line = COMP_LINE
|
||||
const point = +COMP_POINT
|
||||
const partialLine = line.substr(0, point)
|
||||
const partialLine = line.slice(0, point)
|
||||
const partialWords = words.slice(0, w)
|
||||
|
||||
// figure out where in that last word the point is.
|
||||
const partialWordRaw = args[w]
|
||||
let i = partialWordRaw.length
|
||||
while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) {
|
||||
while (partialWordRaw.slice(0, i) !== partialLine.slice(-1 * i) && i > 0) {
|
||||
i--
|
||||
}
|
||||
|
||||
const partialWord = unescape(partialWordRaw.substr(0, i))
|
||||
const partialWord = unescape(partialWordRaw.slice(0, i))
|
||||
partialWords.push(partialWord)
|
||||
|
||||
const opts = {
|
||||
|
||||
Vendored
+3
@@ -266,6 +266,9 @@ ${defData}
|
||||
if (!long) {
|
||||
msg.push(
|
||||
`; node bin location = ${process.execPath}`,
|
||||
`; node version = ${process.version}`,
|
||||
`; npm local prefix = ${this.npm.localPrefix}`,
|
||||
`; npm version = ${this.npm.version}`,
|
||||
`; cwd = ${process.cwd()}`,
|
||||
`; HOME = ${process.env.HOME}`,
|
||||
'; Run `npm config ls -l` to show all defaults.'
|
||||
|
||||
Vendored
+5
-8
@@ -12,7 +12,6 @@ class Dedupe extends ArboristWorkspaceCmd {
|
||||
'legacy-bundling',
|
||||
'strict-peer-deps',
|
||||
'package-lock',
|
||||
'save',
|
||||
'omit',
|
||||
'ignore-scripts',
|
||||
'audit',
|
||||
@@ -29,19 +28,17 @@ class Dedupe extends ArboristWorkspaceCmd {
|
||||
throw er
|
||||
}
|
||||
|
||||
// In the context of `npm dedupe` the save
|
||||
// config value should default to `false`
|
||||
const save = this.npm.config.isDefault('save')
|
||||
? false
|
||||
: this.npm.config.get('save')
|
||||
|
||||
const dryRun = this.npm.config.get('dry-run')
|
||||
const where = this.npm.prefix
|
||||
const opts = {
|
||||
...this.npm.flatOptions,
|
||||
path: where,
|
||||
dryRun,
|
||||
save,
|
||||
// Saving during dedupe would only update if one of your direct
|
||||
// dependencies was also duplicated somewhere in your tree. It would be
|
||||
// confusing if running this were to also update your package.json. In
|
||||
// order to reduce potential confusion we set this to false.
|
||||
save: false,
|
||||
workspaces: this.workspaceNames,
|
||||
}
|
||||
const arb = new Arborist(opts)
|
||||
|
||||
Vendored
+2
-2
@@ -145,7 +145,7 @@ class Doctor extends BaseCommand {
|
||||
return ''
|
||||
} catch (er) {
|
||||
if (/^E\d{3}$/.test(er.code || '')) {
|
||||
throw er.code.substr(1) + ' ' + er.message
|
||||
throw er.code.slice(1) + ' ' + er.message
|
||||
} else {
|
||||
throw er.message
|
||||
}
|
||||
@@ -211,7 +211,7 @@ class Doctor extends BaseCommand {
|
||||
const gid = process.getgid()
|
||||
const files = new Set([root])
|
||||
for (const f of files) {
|
||||
tracker.silly('checkFilesPermission', f.substr(root.length + 1))
|
||||
tracker.silly('checkFilesPermission', f.slice(root.length + 1))
|
||||
const st = await lstat(f).catch(er => {
|
||||
// if it can't be missing, or if it can and the error wasn't that it was missing
|
||||
if (!missingOk || er.code !== 'ENOENT') {
|
||||
|
||||
Vendored
+4
-4
@@ -1,6 +1,6 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const color = require('ansicolors')
|
||||
const chalk = require('chalk')
|
||||
const { promisify } = require('util')
|
||||
const glob = promisify(require('glob'))
|
||||
const readFile = promisify(fs.readFile)
|
||||
@@ -171,9 +171,9 @@ class HelpSearch extends BaseCommand {
|
||||
const finder = line.toLowerCase().split(arg.toLowerCase())
|
||||
let p = 0
|
||||
for (const f of finder) {
|
||||
hilitLine.push(line.substr(p, f.length))
|
||||
const word = line.substr(p + f.length, arg.length)
|
||||
const hilit = color.bgBlack(color.red(word))
|
||||
hilitLine.push(line.slice(p, p + f.length))
|
||||
const word = line.slice(p + f.length, p + f.length + arg.length)
|
||||
const hilit = chalk.bgBlack.red(word)
|
||||
hilitLine.push(hilit)
|
||||
p += f.length + arg.length
|
||||
}
|
||||
|
||||
Vendored
+1
-10
@@ -109,7 +109,6 @@ class Install extends ArboristWorkspaceCmd {
|
||||
const isGlobalInstall = this.npm.config.get('global')
|
||||
const where = isGlobalInstall ? globalTop : this.npm.prefix
|
||||
const forced = this.npm.config.get('force')
|
||||
const isDev = this.npm.config.get('dev')
|
||||
const scriptShell = this.npm.config.get('script-shell') || undefined
|
||||
|
||||
// be very strict about engines when trying to update npm itself
|
||||
@@ -140,14 +139,6 @@ class Install extends ArboristWorkspaceCmd {
|
||||
args = ['.']
|
||||
}
|
||||
|
||||
// TODO: Add warnings for other deprecated flags? or remove this one?
|
||||
if (isDev) {
|
||||
log.warn(
|
||||
'install',
|
||||
'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.'
|
||||
)
|
||||
}
|
||||
|
||||
const opts = {
|
||||
...this.npm.flatOptions,
|
||||
auditLevel: null,
|
||||
@@ -163,7 +154,7 @@ class Install extends ArboristWorkspaceCmd {
|
||||
'preinstall',
|
||||
'install',
|
||||
'postinstall',
|
||||
'prepublish', // XXX should we remove this finally??
|
||||
'prepublish', // XXX(npm9) should we remove this finally??
|
||||
'preprepare',
|
||||
'prepare',
|
||||
'postprepare',
|
||||
|
||||
Vendored
+11
-34
@@ -52,16 +52,12 @@ class LS extends ArboristWorkspaceCmd {
|
||||
const all = this.npm.config.get('all')
|
||||
const color = this.npm.color
|
||||
const depth = this.npm.config.get('depth')
|
||||
const dev = this.npm.config.get('dev')
|
||||
const development = this.npm.config.get('development')
|
||||
const global = this.npm.config.get('global')
|
||||
const json = this.npm.config.get('json')
|
||||
const link = this.npm.config.get('link')
|
||||
const long = this.npm.config.get('long')
|
||||
const only = this.npm.config.get('only')
|
||||
const omit = this.npm.flatOptions.omit
|
||||
const parseable = this.npm.config.get('parseable')
|
||||
const prod = this.npm.config.get('prod')
|
||||
const production = this.npm.config.get('production')
|
||||
const unicode = this.npm.config.get('unicode')
|
||||
const packageLockOnly = this.npm.config.get('package-lock-only')
|
||||
const workspacesEnabled = this.npm.flatOptions.workspacesEnabled
|
||||
@@ -138,15 +134,10 @@ class LS extends ArboristWorkspaceCmd {
|
||||
? []
|
||||
: [...(node.target).edgesOut.values()]
|
||||
.filter(filterBySelectedWorkspaces)
|
||||
.filter(filterByEdgesTypes({
|
||||
currentDepth,
|
||||
dev,
|
||||
development,
|
||||
.filter(currentDepth === 0 ? filterByEdgesTypes({
|
||||
link,
|
||||
prod,
|
||||
production,
|
||||
only,
|
||||
}))
|
||||
omit,
|
||||
}) : () => true)
|
||||
.map(mapEdgesToNodes({ seenPaths }))
|
||||
.concat(appendExtraneousChildren({ node, seenPaths }))
|
||||
.sort(sortAlphabetically)
|
||||
@@ -399,27 +390,13 @@ const getJsonOutputItem = (node, { global, long }) => {
|
||||
return augmentItemWithIncludeMetadata(node, item)
|
||||
}
|
||||
|
||||
const filterByEdgesTypes = ({
|
||||
currentDepth,
|
||||
dev,
|
||||
development,
|
||||
link,
|
||||
prod,
|
||||
production,
|
||||
only,
|
||||
}) => {
|
||||
// filter deps by type, allows for: `npm ls --dev`, `npm ls --prod`,
|
||||
// `npm ls --link`, `npm ls --only=dev`, etc
|
||||
const filterDev = currentDepth === 0 &&
|
||||
(dev || development || /^dev(elopment)?$/.test(only))
|
||||
const filterProd = currentDepth === 0 &&
|
||||
(prod || production || /^prod(uction)?$/.test(only))
|
||||
const filterLink = currentDepth === 0 && link
|
||||
|
||||
return (edge) =>
|
||||
(filterDev ? edge.dev : true) &&
|
||||
(filterProd ? (!edge.dev && !edge.peer && !edge.peerOptional) : true) &&
|
||||
(filterLink ? (edge.to && edge.to.isLink) : true)
|
||||
const filterByEdgesTypes = ({ link, omit = [] }) => (edge) => {
|
||||
for (const omitType of omit) {
|
||||
if (edge[omitType]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return link ? edge.to && edge.to.isLink : true
|
||||
}
|
||||
|
||||
const appendExtraneousChildren = ({ node, seenPaths }) =>
|
||||
|
||||
Vendored
+7
-8
@@ -2,8 +2,7 @@ const os = require('os')
|
||||
const path = require('path')
|
||||
const pacote = require('pacote')
|
||||
const table = require('text-table')
|
||||
const color = require('chalk')
|
||||
const styles = require('ansistyles')
|
||||
const chalk = require('chalk')
|
||||
const npa = require('npm-package-arg')
|
||||
const pickManifest = require('npm-pick-manifest')
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
@@ -106,7 +105,7 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
const outTable = [outHead].concat(outList)
|
||||
|
||||
if (this.npm.color) {
|
||||
outTable[0] = outTable[0].map(heading => styles.underline(heading))
|
||||
outTable[0] = outTable[0].map(heading => chalk.underline(heading))
|
||||
}
|
||||
|
||||
const tableOpts = {
|
||||
@@ -208,7 +207,7 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
: edge.dev ? 'devDependencies'
|
||||
: 'dependencies'
|
||||
|
||||
for (const omitType of this.npm.config.get('omit')) {
|
||||
for (const omitType of this.npm.flatOptions.omit) {
|
||||
if (node[omitType]) {
|
||||
return
|
||||
}
|
||||
@@ -282,7 +281,7 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
: node.name
|
||||
|
||||
return this.npm.color && humanOutput
|
||||
? color.green(workspaceName)
|
||||
? chalk.green(workspaceName)
|
||||
: workspaceName
|
||||
}
|
||||
|
||||
@@ -307,9 +306,9 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
}
|
||||
|
||||
if (this.npm.color) {
|
||||
columns[0] = color[current === wanted ? 'yellow' : 'red'](columns[0]) // current
|
||||
columns[2] = color.green(columns[2]) // wanted
|
||||
columns[3] = color.magenta(columns[3]) // latest
|
||||
columns[0] = chalk[current === wanted ? 'yellow' : 'red'](columns[0]) // current
|
||||
columns[2] = chalk.green(columns[2]) // wanted
|
||||
columns[3] = chalk.magenta(columns[3]) // latest
|
||||
}
|
||||
|
||||
return columns
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
const inspect = require('util').inspect
|
||||
const { URL } = require('url')
|
||||
const ansistyles = require('ansistyles')
|
||||
const chalk = require('chalk')
|
||||
const log = require('../utils/log-shim.js')
|
||||
const npmProfile = require('npm-profile')
|
||||
const qrcodeTerminal = require('qrcode-terminal')
|
||||
@@ -163,7 +163,7 @@ class Profile extends BaseCommand {
|
||||
} else {
|
||||
const table = new Table()
|
||||
for (const key of Object.keys(cleaned)) {
|
||||
table.push({ [ansistyles.bright(key)]: cleaned[key] })
|
||||
table.push({ [chalk.bold(key)]: cleaned[key] })
|
||||
}
|
||||
|
||||
this.npm.output(table.toString())
|
||||
|
||||
Vendored
+17
-12
@@ -102,19 +102,24 @@ class Publish extends BaseCommand {
|
||||
logTar(pkgContents, { unicode })
|
||||
}
|
||||
|
||||
if (!dryRun) {
|
||||
const resolved = npa.resolve(manifest.name, manifest.version)
|
||||
const registry = npmFetch.pickRegistry(resolved, opts)
|
||||
const creds = this.npm.config.getCredentialsByURI(registry)
|
||||
const outputRegistry = replaceInfo(registry)
|
||||
if (!creds.token && !creds.username) {
|
||||
throw Object.assign(
|
||||
new Error(`This command requires you to be logged in to ${outputRegistry}`), {
|
||||
code: 'ENEEDAUTH',
|
||||
}
|
||||
)
|
||||
const resolved = npa.resolve(manifest.name, manifest.version)
|
||||
const registry = npmFetch.pickRegistry(resolved, opts)
|
||||
const creds = this.npm.config.getCredentialsByURI(registry)
|
||||
const noCreds = !creds.token && !creds.username
|
||||
const outputRegistry = replaceInfo(registry)
|
||||
|
||||
if (noCreds) {
|
||||
const msg = `This command requires you to be logged in to ${outputRegistry}`
|
||||
if (dryRun) {
|
||||
log.warn('', `${msg} (dry-run)`)
|
||||
} else {
|
||||
throw Object.assign(new Error(msg), { code: 'ENEEDAUTH' })
|
||||
}
|
||||
log.notice('', `Publishing to ${outputRegistry}`)
|
||||
}
|
||||
|
||||
log.notice('', `Publishing to ${outputRegistry}${dryRun ? ' (dry-run)' : ''}`)
|
||||
|
||||
if (!dryRun) {
|
||||
await otplease(opts, opts => libpub(manifest, tarballData, opts))
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
const Table = require('cli-table3')
|
||||
const ansistyles = require('ansistyles')
|
||||
const chalk = require('chalk')
|
||||
const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr')
|
||||
const log = require('../utils/log-shim.js')
|
||||
const profile = require('npm-profile')
|
||||
@@ -161,7 +161,7 @@ class Token extends BaseCommand {
|
||||
} else {
|
||||
const table = new Table()
|
||||
for (const k of Object.keys(result)) {
|
||||
table.push({ [ansistyles.bright(k)]: String(result[k]) })
|
||||
table.push({ [chalk.bold(k)]: String(result[k]) })
|
||||
}
|
||||
this.npm.output(table.toString())
|
||||
}
|
||||
|
||||
Vendored
+26
-27
@@ -3,7 +3,7 @@
|
||||
|
||||
// npm view [pkg [pkg ...]]
|
||||
|
||||
const color = require('ansicolors')
|
||||
const chalk = require('chalk')
|
||||
const columns = require('cli-columns')
|
||||
const fs = require('fs')
|
||||
const jsonParse = require('json-parse-even-better-errors')
|
||||
@@ -13,7 +13,6 @@ const { resolve } = require('path')
|
||||
const formatBytes = require('../utils/format-bytes.js')
|
||||
const relativeDate = require('tiny-relative-date')
|
||||
const semver = require('semver')
|
||||
const style = require('ansistyles')
|
||||
const { inspect, promisify } = require('util')
|
||||
const { packument } = require('pacote')
|
||||
|
||||
@@ -318,34 +317,34 @@ class View extends BaseCommand {
|
||||
|
||||
Object.keys(packument['dist-tags']).forEach((t) => {
|
||||
const version = packument['dist-tags'][t]
|
||||
tags.push(`${style.bright(color.green(t))}: ${version}`)
|
||||
tags.push(`${chalk.bold.green(t)}: ${version}`)
|
||||
})
|
||||
const unpackedSize = manifest.dist.unpackedSize &&
|
||||
formatBytes(manifest.dist.unpackedSize, true)
|
||||
const licenseField = manifest.license || 'Proprietary'
|
||||
const info = {
|
||||
name: color.green(manifest.name),
|
||||
version: color.green(manifest.version),
|
||||
bins: Object.keys(manifest.bin || {}).map(color.yellow),
|
||||
versions: color.yellow(packument.versions.length + ''),
|
||||
name: chalk.green(manifest.name),
|
||||
version: chalk.green(manifest.version),
|
||||
bins: Object.keys(manifest.bin || {}),
|
||||
versions: chalk.yellow(packument.versions.length + ''),
|
||||
description: manifest.description,
|
||||
deprecated: manifest.deprecated,
|
||||
keywords: (packument.keywords || []).map(color.yellow),
|
||||
keywords: packument.keywords || [],
|
||||
license: typeof licenseField === 'string'
|
||||
? licenseField
|
||||
: (licenseField.type || 'Proprietary'),
|
||||
deps: Object.keys(manifest.dependencies || {}).map((dep) => {
|
||||
return `${color.yellow(dep)}: ${manifest.dependencies[dep]}`
|
||||
return `${chalk.yellow(dep)}: ${manifest.dependencies[dep]}`
|
||||
}),
|
||||
publisher: manifest._npmUser && unparsePerson({
|
||||
name: color.yellow(manifest._npmUser.name),
|
||||
email: color.cyan(manifest._npmUser.email),
|
||||
name: chalk.yellow(manifest._npmUser.name),
|
||||
email: chalk.cyan(manifest._npmUser.email),
|
||||
}),
|
||||
modified: !packument.time ? undefined
|
||||
: color.yellow(relativeDate(packument.time[manifest.version])),
|
||||
: chalk.yellow(relativeDate(packument.time[manifest.version])),
|
||||
maintainers: (packument.maintainers || []).map((u) => unparsePerson({
|
||||
name: color.yellow(u.name),
|
||||
email: color.cyan(u.email),
|
||||
name: chalk.yellow(u.name),
|
||||
email: chalk.cyan(u.email),
|
||||
})),
|
||||
repo: (
|
||||
manifest.bugs && (manifest.bugs.url || manifest.bugs)
|
||||
@@ -356,47 +355,47 @@ class View extends BaseCommand {
|
||||
manifest.homepage && (manifest.homepage.url || manifest.homepage)
|
||||
),
|
||||
tags,
|
||||
tarball: color.cyan(manifest.dist.tarball),
|
||||
shasum: color.yellow(manifest.dist.shasum),
|
||||
tarball: chalk.cyan(manifest.dist.tarball),
|
||||
shasum: chalk.yellow(manifest.dist.shasum),
|
||||
integrity:
|
||||
manifest.dist.integrity && color.yellow(manifest.dist.integrity),
|
||||
manifest.dist.integrity && chalk.yellow(manifest.dist.integrity),
|
||||
fileCount:
|
||||
manifest.dist.fileCount && color.yellow(manifest.dist.fileCount),
|
||||
unpackedSize: unpackedSize && color.yellow(unpackedSize),
|
||||
manifest.dist.fileCount && chalk.yellow(manifest.dist.fileCount),
|
||||
unpackedSize: unpackedSize && chalk.yellow(unpackedSize),
|
||||
}
|
||||
if (info.license.toLowerCase().trim() === 'proprietary') {
|
||||
info.license = style.bright(color.red(info.license))
|
||||
info.license = chalk.bold.red(info.license)
|
||||
} else {
|
||||
info.license = color.green(info.license)
|
||||
info.license = chalk.green(info.license)
|
||||
}
|
||||
|
||||
console.log('')
|
||||
console.log(
|
||||
style.underline(style.bright(`${info.name}@${info.version}`)) +
|
||||
chalk.underline.bold(`${info.name}@${info.version}`) +
|
||||
' | ' + info.license +
|
||||
' | deps: ' + (info.deps.length ? color.cyan(info.deps.length) : color.green('none')) +
|
||||
' | deps: ' + (info.deps.length ? chalk.cyan(info.deps.length) : chalk.green('none')) +
|
||||
' | versions: ' + info.versions
|
||||
)
|
||||
info.description && console.log(info.description)
|
||||
if (info.repo || info.site) {
|
||||
info.site && console.log(color.cyan(info.site))
|
||||
info.site && console.log(chalk.cyan(info.site))
|
||||
}
|
||||
|
||||
const warningSign = unicode ? ' ⚠️ ' : '!!'
|
||||
info.deprecated && console.log(
|
||||
`\n${style.bright(color.red('DEPRECATED'))}${
|
||||
`\n${chalk.bold.red('DEPRECATED')}${
|
||||
warningSign
|
||||
} - ${info.deprecated}`
|
||||
)
|
||||
|
||||
if (info.keywords.length) {
|
||||
console.log('')
|
||||
console.log('keywords:', info.keywords.join(', '))
|
||||
console.log('keywords:', chalk.yellow(info.keywords.join(', ')))
|
||||
}
|
||||
|
||||
if (info.bins.length) {
|
||||
console.log('')
|
||||
console.log('bin:', info.bins.join(', '))
|
||||
console.log('bin:', chalk.yellow(info.bins.join(', ')))
|
||||
}
|
||||
|
||||
console.log('')
|
||||
|
||||
Vendored
+3
@@ -131,6 +131,7 @@ class Npm extends EventEmitter {
|
||||
|
||||
const isGlobal = this.config.get('global')
|
||||
const workspacesEnabled = this.config.get('workspaces')
|
||||
// if cwd is a workspace, the default is set to [that workspace]
|
||||
const implicitWorkspace = this.config.get('workspace', 'default').length > 0
|
||||
const workspacesFilters = this.config.get('workspace')
|
||||
const includeWorkspaceRoot = this.config.get('include-workspace-root')
|
||||
@@ -138,6 +139,8 @@ class Npm extends EventEmitter {
|
||||
// or when it is implicit and not in our ignore list
|
||||
const hasWorkspaceFilters = workspacesFilters.length > 0
|
||||
const invalidWorkspaceConfig = workspacesEnabled === false && hasWorkspaceFilters
|
||||
|
||||
// (-ws || -w foo) && (cwd is not a workspace || command is not ignoring implicit workspaces)
|
||||
const filterByWorkspaces = (workspacesEnabled || hasWorkspaceFilters) &&
|
||||
(!implicitWorkspace || !command.ignoreImplicitWorkspace)
|
||||
// normally this would go in the constructor, but our tests don't
|
||||
|
||||
+3
-3
@@ -111,7 +111,7 @@ function addColorMarker (str, arg, i) {
|
||||
|
||||
if (arg.charAt(0) === '/') {
|
||||
return str.replace(
|
||||
new RegExp(arg.substr(1, arg.length - 2), 'gi'),
|
||||
new RegExp(arg.slice(1, -1), 'gi'),
|
||||
bit => markStart + bit + markEnd
|
||||
)
|
||||
}
|
||||
@@ -121,9 +121,9 @@ function addColorMarker (str, arg, i) {
|
||||
var p = 0
|
||||
|
||||
return pieces.map(function (piece) {
|
||||
piece = str.substr(p, piece.length)
|
||||
piece = str.slice(p, p + piece.length)
|
||||
var mark = markStart +
|
||||
str.substr(p + piece.length, arg.length) +
|
||||
str.slice(p + piece.length, p + piece.length + arg.length) +
|
||||
markEnd
|
||||
p += piece.length + arg.length
|
||||
return piece + mark
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ function filterWords (data, include, exclude, opts) {
|
||||
function match (words, pattern) {
|
||||
if (pattern.charAt(0) === '/') {
|
||||
pattern = pattern.replace(/\/$/, '')
|
||||
pattern = new RegExp(pattern.substr(1, pattern.length - 1))
|
||||
pattern = new RegExp(pattern.slice(1))
|
||||
return words.match(pattern)
|
||||
}
|
||||
return words.indexOf(pattern) !== -1
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ const wrapAll = s => {
|
||||
return (
|
||||
'* ' +
|
||||
block
|
||||
.substr(1)
|
||||
.slice(1)
|
||||
.trim()
|
||||
.split('\n* ')
|
||||
.map(li => {
|
||||
|
||||
+4
-2
@@ -880,6 +880,7 @@ define('https-proxy', {
|
||||
define('if-present', {
|
||||
default: false,
|
||||
type: Boolean,
|
||||
envExport: false,
|
||||
description: `
|
||||
If true, npm will not exit with an error code when \`run-script\` is
|
||||
invoked for a script that isn't defined in the \`scripts\` section of
|
||||
@@ -938,6 +939,7 @@ define('include-staged', {
|
||||
define('include-workspace-root', {
|
||||
default: false,
|
||||
type: Boolean,
|
||||
envExport: false,
|
||||
description: `
|
||||
Include the workspace root when workspaces are enabled for a command.
|
||||
|
||||
@@ -1605,8 +1607,8 @@ define('registry', {
|
||||
|
||||
define('save', {
|
||||
default: true,
|
||||
defaultDescription: `\`true\` unless when using \`npm update\` or
|
||||
\`npm dedupe\` where it defaults to \`false\``,
|
||||
defaultDescription: `\`true\` unless when using \`npm update\` where it
|
||||
defaults to \`false\``,
|
||||
usage: '-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle',
|
||||
type: Boolean,
|
||||
short: 'S',
|
||||
|
||||
Vendored
+1
-1
@@ -53,7 +53,7 @@ const wrap = (arr) => {
|
||||
out[l] = c
|
||||
}
|
||||
}
|
||||
return out.join('\n ').substr(2)
|
||||
return out.join('\n ').slice(2)
|
||||
}
|
||||
|
||||
const usages = async (npm) => {
|
||||
|
||||
Vendored
+2
-2
@@ -48,9 +48,9 @@ const logTar = (tarball, opts = {}) => {
|
||||
{
|
||||
name: 'integrity:',
|
||||
value:
|
||||
tarball.integrity.toString().substr(0, 20) +
|
||||
tarball.integrity.toString().slice(0, 20) +
|
||||
'[...]' +
|
||||
tarball.integrity.toString().substr(80),
|
||||
tarball.integrity.toString().slice(80),
|
||||
},
|
||||
tarball.bundled.length && { name: 'bundled deps:', value: tarball.bundled.length },
|
||||
tarball.bundled.length && {
|
||||
|
||||
+9
-1
@@ -11,6 +11,8 @@ const stat = promisify(require('fs').stat)
|
||||
const writeFile = promisify(require('fs').writeFile)
|
||||
const { resolve } = require('path')
|
||||
|
||||
const SKIP = Symbol('SKIP')
|
||||
|
||||
const isGlobalNpmUpdate = npm => {
|
||||
return npm.flatOptions.global &&
|
||||
['install', 'update'].includes(npm.command) &&
|
||||
@@ -38,7 +40,7 @@ const updateNotifier = async (npm, spec = 'latest') => {
|
||||
if (!npm.config.get('update-notifier') ||
|
||||
isGlobalNpmUpdate(npm) ||
|
||||
ciDetect()) {
|
||||
return null
|
||||
return SKIP
|
||||
}
|
||||
|
||||
// if we're on a prerelease train, then updates are coming fast
|
||||
@@ -118,6 +120,12 @@ const updateNotifier = async (npm, spec = 'latest') => {
|
||||
// only update the notification timeout if we actually finished checking
|
||||
module.exports = async npm => {
|
||||
const notification = await updateNotifier(npm)
|
||||
|
||||
// dont write the file if we skipped checking altogether
|
||||
if (notification === SKIP) {
|
||||
return null
|
||||
}
|
||||
|
||||
// intentional. do not await this. it's a best-effort update. if this
|
||||
// fails, it's ok. might be using /dev/null as the cache or something weird
|
||||
// like that.
|
||||
|
||||
+13
-3
@@ -1,8 +1,11 @@
|
||||
const { resolve } = require('path')
|
||||
const { resolve, relative } = require('path')
|
||||
const mapWorkspaces = require('@npmcli/map-workspaces')
|
||||
const minimatch = require('minimatch')
|
||||
const rpj = require('read-package-json-fast')
|
||||
|
||||
// minimatch wants forward slashes only for glob patterns
|
||||
const globify = pattern => pattern.split('\\').join('/')
|
||||
|
||||
// Returns an Map of paths to workspaces indexed by workspace name
|
||||
// { foo => '/path/to/foo' }
|
||||
const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom }) => {
|
||||
@@ -20,9 +23,16 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom
|
||||
|
||||
for (const filterArg of filters) {
|
||||
for (const [workspaceName, workspacePath] of workspaces.entries()) {
|
||||
let relativePath = relative(relativeFrom, workspacePath)
|
||||
if (filterArg.startsWith('./')) {
|
||||
relativePath = `./${relativePath}`
|
||||
}
|
||||
const relativeFilter = relative(path, filterArg)
|
||||
if (filterArg === workspaceName
|
||||
|| resolve(relativeFrom || path, filterArg) === workspacePath
|
||||
|| minimatch(workspacePath, `${resolve(relativeFrom || path, filterArg)}/*`)) {
|
||||
|| resolve(relativeFrom, filterArg) === workspacePath
|
||||
|| minimatch(relativePath, `${globify(relativeFilter)}/*`)
|
||||
|| minimatch(relativePath, `${globify(filterArg)}/*`)
|
||||
) {
|
||||
res.set(workspaceName, workspacePath)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-ACCESS" "1" "March 2022" "" ""
|
||||
.TH "NPM\-ACCESS" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-access\fR \- Set access level on published packages
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-ADDUSER" "1" "March 2022" "" ""
|
||||
.TH "NPM\-ADDUSER" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-adduser\fR \- Add a registry user account
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-AUDIT" "1" "March 2022" "" ""
|
||||
.TH "NPM\-AUDIT" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-audit\fR \- Run a security audit
|
||||
.SS Synopsis
|
||||
@@ -421,6 +421,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-BIN" "1" "March 2022" "" ""
|
||||
.TH "NPM\-BIN" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-bin\fR \- Display npm bin folder
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-BUGS" "1" "March 2022" "" ""
|
||||
.TH "NPM\-BUGS" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-bugs\fR \- Report bugs for a package in a web browser
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-CACHE" "1" "March 2022" "" ""
|
||||
.TH "NPM\-CACHE" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-cache\fR \- Manipulates packages cache
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+8
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-CI" "1" "March 2022" "" ""
|
||||
.TH "NPM\-CI" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-ci\fR \- Install a project with a clean slate
|
||||
.SS Synopsis
|
||||
@@ -45,6 +45,13 @@ It will never write to \fBpackage\.json\fP or any of the package\-locks:
|
||||
installs are essentially frozen\.
|
||||
|
||||
.RE
|
||||
.P
|
||||
NOTE: If you create your \fBpackage\-lock\.json\fP file by running \fBnpm install\fP
|
||||
with flags that can affect the shape of your dependency tree, such as
|
||||
\fB\-\-legacy\-peer\-deps\fP, you \fImust\fR provide the same flags to \fBnpm ci\fP or you
|
||||
are likely to encounter errors\. An easy way to do this is to run
|
||||
\fBnpm config set legacy\-peer\-deps=true \-\-location=project\fP and commit the
|
||||
\fB\|\.npmrc\fP file to your repo\.
|
||||
.SS Example
|
||||
.P
|
||||
Make sure you have a package\-lock and an up\-to\-date install:
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-COMPLETION" "1" "March 2022" "" ""
|
||||
.TH "NPM\-COMPLETION" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-completion\fR \- Tab Completion for npm
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-CONFIG" "1" "March 2022" "" ""
|
||||
.TH "NPM\-CONFIG" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-config\fR \- Manage the npm configuration files
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+6
-22
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DEDUPE" "1" "March 2022" "" ""
|
||||
.TH "NPM\-DEDUPE" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-dedupe\fR \- Reduce duplication in the package tree
|
||||
.SS Synopsis
|
||||
@@ -75,11 +75,9 @@ result in new modules being installed\.
|
||||
.P
|
||||
Using \fBnpm find\-dupes\fP will run the command in \fB\-\-dry\-run\fP mode\.
|
||||
.P
|
||||
Note that by default \fBnpm dedupe\fP will not update the semver values of direct
|
||||
dependencies in your project \fBpackage\.json\fP, if you want to also update
|
||||
values in \fBpackage\.json\fP you can run: \fBnpm dedupe \-\-save\fP (or add the
|
||||
\fBsave=true\fP option to a npm help configuration file
|
||||
to make that the default behavior)\.
|
||||
Note: \fBnpm dedupe\fP will never update the semver values of direct
|
||||
dependencies in your project \fBpackage\.json\fP, if you want to update
|
||||
values in \fBpackage\.json\fP you can run: \fBnpm update \-\-save\fP instead\.
|
||||
.SS Configuration
|
||||
.SS \fBglobal\-style\fP
|
||||
.RS 0
|
||||
@@ -148,22 +146,6 @@ modules will also be disabled\. To remove extraneous modules with
|
||||
package\-locks disabled use \fBnpm prune\fP\|\.
|
||||
.P
|
||||
This configuration does not affect \fBnpm ci\fP\|\.
|
||||
.SS \fBsave\fP
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it
|
||||
defaults to \fBfalse\fP
|
||||
.IP \(bu 2
|
||||
Type: Boolean
|
||||
|
||||
.RE
|
||||
.P
|
||||
Save installed packages to a \fBpackage\.json\fP file as dependencies\.
|
||||
.P
|
||||
When used with the \fBnpm rm\fP command, removes the dependency from
|
||||
\fBpackage\.json\fP\|\.
|
||||
.P
|
||||
Will also prevent writing to \fBpackage\-lock\.json\fP if set to \fBfalse\fP\|\.
|
||||
.SS \fBomit\fP
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
@@ -324,6 +306,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DEPRECATE" "1" "March 2022" "" ""
|
||||
.TH "NPM\-DEPRECATE" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-deprecate\fR \- Deprecate a version of a package
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DIFF" "1" "March 2022" "" ""
|
||||
.TH "NPM\-DIFF" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-diff\fR \- The registry diff command
|
||||
.SS Synopsis
|
||||
@@ -333,6 +333,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SH See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DIST\-TAG" "1" "March 2022" "" ""
|
||||
.TH "NPM\-DIST\-TAG" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-dist-tag\fR \- Modify package distribution tags
|
||||
.SS Synopsis
|
||||
@@ -159,6 +159,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DOCS" "1" "March 2022" "" ""
|
||||
.TH "NPM\-DOCS" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-docs\fR \- Open documentation for a package in a web browser
|
||||
.SS Synopsis
|
||||
@@ -111,6 +111,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DOCTOR" "1" "March 2022" "" ""
|
||||
.TH "NPM\-DOCTOR" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-doctor\fR \- Check your npm environment
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EDIT" "1" "March 2022" "" ""
|
||||
.TH "NPM\-EDIT" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-edit\fR \- Edit an installed package
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EXEC" "1" "March 2022" "" ""
|
||||
.TH "NPM\-EXEC" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-exec\fR \- Run a command from a local or remote npm package
|
||||
.SS Synopsis
|
||||
@@ -215,6 +215,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SS Examples
|
||||
.P
|
||||
Run the version of \fBtap\fP in the local dependencies, with the provided
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EXPLAIN" "1" "March 2022" "" ""
|
||||
.TH "NPM\-EXPLAIN" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-explain\fR \- Explain installed packages
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EXPLORE" "1" "March 2022" "" ""
|
||||
.TH "NPM\-EXPLORE" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-explore\fR \- Browse an installed package
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-FIND\-DUPES" "1" "March 2022" "" ""
|
||||
.TH "NPM\-FIND\-DUPES" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-find-dupes\fR \- Find duplication in the package tree
|
||||
.SS Synopsis
|
||||
@@ -224,6 +224,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-FUND" "1" "March 2022" "" ""
|
||||
.TH "NPM\-FUND" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-fund\fR \- Retrieve funding information
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-HELP\-SEARCH" "1" "March 2022" "" ""
|
||||
.TH "NPM\-HELP\-SEARCH" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-help-search\fR \- Search npm help documentation
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-HELP" "1" "March 2022" "" ""
|
||||
.TH "NPM\-HELP" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-help\fR \- Get help on npm
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-HOOK" "1" "March 2022" "" ""
|
||||
.TH "NPM\-HOOK" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-hook\fR \- Manage registry hooks
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-INIT" "1" "March 2022" "" ""
|
||||
.TH "NPM\-INIT" "1" "April 2022" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-init\fR \- Create a package\.json file
|
||||
.SS Synopsis
|
||||
@@ -300,6 +300,8 @@ Include the workspace root when workspaces are enabled for a command\.
|
||||
When false, specifying individual workspaces via the \fBworkspace\fP config, or
|
||||
all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
|
||||
the specified workspaces, and not on the root project\.
|
||||
.P
|
||||
This value is not exported to the environment for child processes\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Loaded 100 of 340 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user