Skip to content

Commit 9ceb9c1

Browse files
authored
docs: rewrap markdown (#8636)
1 parent d352e27 commit 9ceb9c1

Some content is hidden

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

79 files changed

+1554
-2407
lines changed

docs/lib/content/commands/npm-access.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@ description: Set access level on published packages
1212

1313
Used to set access controls on private packages.
1414

15-
For all of the subcommands, `npm access` will perform actions on the packages
16-
in the current working directory if no package name is passed to the
17-
subcommand.
15+
For all of the subcommands, `npm access` will perform actions on the packages in the current working directory if no package name is passed to the subcommand.
1816

1917
* grant / revoke:
2018
Add or remove the ability of users and teams to have read-only or read-write
2119
access to a package.
2220

2321
### Details
2422

25-
`npm access` always operates directly on the current registry, configurable
26-
from the command line using `--registry=<registry url>`.
23+
`npm access` always operates directly on the current registry, configurable from the command line using `--registry=<registry url>`.
2724

2825
Unscoped packages are *always public*.
2926

30-
Scoped packages *default to restricted*, but you can either publish them as
31-
public using `npm publish --access=public`, or set their access as public using
32-
`npm access set status=public` after the initial publish.
27+
Scoped packages *default to restricted*, but you can either publish them as public using `npm publish --access=public`, or set their access as public using `npm access set status=public` after the initial publish.
3328

3429
You must have privileges to set the access of a package:
3530

@@ -38,11 +33,9 @@ You must have privileges to set the access of a package:
3833
* You have been given read-write privileges for a package, either as a member
3934
of a team or directly as an owner.
4035

41-
If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the `--otp=...` option to specify it on
42-
the command line.
36+
If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the `--otp=...` option to specify it on the command line.
4337

44-
If your account is not paid, then attempts to publish scoped packages will
45-
fail with an HTTP 402 status code (logically enough), unless you use
38+
If your account is not paid, then attempts to publish scoped packages will fail with an HTTP 402 status code (logically enough), unless you use
4639
`--access=public`.
4740

4841
Management of teams and team memberships is done with the `npm team` command.

docs/lib/content/commands/npm-adduser.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ description: Add a registry user account
1010

1111
### Description
1212

13-
Create a new user in the specified registry, and save the credentials to
14-
the `.npmrc` file. If no registry is specified, the default registry
15-
will be used (see [`registry`](/using-npm/registry)).
13+
Create a new user in the specified registry, and save the credentials to the `.npmrc` file.
14+
If no registry is specified, the default registry will be used (see [`registry`](/using-npm/registry)).
1615

17-
When you run `npm adduser`, the CLI automatically generates a legacy token of `publish` type. For more information, see [About legacy tokens](/about-access-tokens#about-legacy-tokens).
16+
When you run `npm adduser`, the CLI automatically generates a legacy token of `publish` type.
17+
For more information, see [About legacy tokens](/about-access-tokens#about-legacy-tokens).
1818

19-
When using `legacy` for your `auth-type`, the username, password, and
20-
email are read in from prompts.
19+
When using `legacy` for your `auth-type`, the username, password, and email are read in from prompts.
2120

2221
### Configuration
2322

docs/lib/content/commands/npm-audit.md

Lines changed: 39 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,23 @@ description: Run a security audit
1010

1111
### Description
1212

13-
The audit command submits a description of the dependencies configured in
14-
your project to your default registry and asks for a report of known
15-
vulnerabilities. If any vulnerabilities are found, then the impact and
16-
appropriate remediation will be calculated. If the `fix` argument is
17-
provided, then remediations will be applied to the package tree.
13+
The audit command submits a description of the dependencies configured in your project to your default registry and asks for a report of known vulnerabilities.
14+
If any vulnerabilities are found, then the impact and appropriate remediation will be calculated.
15+
If the `fix` argument is provided, then remediations will be applied to the package tree.
1816

1917
The command will exit with a 0 exit code if no vulnerabilities were found.
2018

21-
Note that some vulnerabilities cannot be fixed automatically and will
22-
require manual intervention or review. Also note that since `npm audit
23-
fix` runs a full-fledged `npm install` under the hood, all configs that
24-
apply to the installer will also apply to `npm install` -- so things like
25-
`npm audit fix --package-lock-only` will work as expected.
19+
Note that some vulnerabilities cannot be fixed automatically and will require manual intervention or review.
20+
Also note that since `npm audit fix` runs a full-fledged `npm install` under the hood, all configs that apply to the installer will also apply to `npm install` -- so things like `npm audit fix --package-lock-only` will work as expected.
2621

27-
By default, the audit command will exit with a non-zero code if any
28-
vulnerability is found. It may be useful in CI environments to include the
29-
`--audit-level` parameter to specify the minimum vulnerability level that
30-
will cause the command to fail. This option does not filter the report
31-
output, it simply changes the command's failure threshold.
22+
By default, the audit command will exit with a non-zero code if any vulnerability is found.
23+
It may be useful in CI environments to include the `--audit-level` parameter to specify the minimum vulnerability level that will cause the command to fail.
24+
This option does not filter the report output, it simply changes the command's failure threshold.
3225

3326
### Package lock
3427

35-
By default npm requires a package-lock or shrinkwrap in order to run the
36-
audit. You can bypass the package lock with `--no-package-lock` but be
37-
aware the results may be different with every run, since npm will
38-
re-build the dependency tree each time.
28+
By default npm requires a package-lock or shrinkwrap in order to run the audit.
29+
You can bypass the package lock with `--no-package-lock` but be aware the results may be different with every run, since npm will re-build the dependency tree each time.
3930

4031
### Audit Signatures
4132

@@ -47,12 +38,9 @@ Registry signatures can be verified using the following `audit` command:
4738
$ npm audit signatures
4839
```
4940

50-
The `audit signatures` command will also verify the provenance attestations of
51-
downloaded packages. Because provenance attestations are such a new feature,
52-
security features may be added to (or changed in) the attestation format over
53-
time. To ensure that you're always able to verify attestation signatures check
54-
that you're running the latest version of the npm CLI. Please note this often
55-
means updating npm beyond the version that ships with Node.js.
41+
The `audit signatures` command will also verify the provenance attestations of downloaded packages.
42+
Because provenance attestations are such a new feature, security features may be added to (or changed in) the attestation format over time.
43+
To ensure that you're always able to verify attestation signatures check that you're running the latest version of the npm CLI. Please note this often means updating npm beyond the version that ships with Node.js.
5644

5745
The npm CLI supports registry signatures and signing keys provided by any registry if the following conventions are followed:
5846

@@ -98,42 +86,29 @@ See this [example key's response from the public npm registry](https://registry.
9886

9987
### Audit Endpoints
10088

101-
There are two audit endpoints that npm may use to fetch vulnerability
102-
information: the `Bulk Advisory` endpoint and the `Quick Audit` endpoint.
89+
There are two audit endpoints that npm may use to fetch vulnerability information: the `Bulk Advisory` endpoint and the `Quick Audit` endpoint.
10390

10491
#### Bulk Advisory Endpoint
10592

106-
As of version 7, npm uses the much faster `Bulk Advisory` endpoint to
107-
optimize the speed of calculating audit results.
93+
As of version 7, npm uses the much faster `Bulk Advisory` endpoint to optimize the speed of calculating audit results.
10894

109-
npm will generate a JSON payload with the name and list of versions of each
110-
package in the tree, and POST it to the default configured registry at
111-
the path `/-/npm/v1/security/advisories/bulk`.
95+
npm will generate a JSON payload with the name and list of versions of each package in the tree, and POST it to the default configured registry at the path `/-/npm/v1/security/advisories/bulk`.
11296

113-
Any packages in the tree that do not have a `version` field in their
114-
package.json file will be ignored. If any `--omit` options are specified
115-
(either via the [`--omit` config](/using-npm/config#omit), or one of the
116-
shorthands such as `--production`, `--only=dev`, and so on), then packages will
117-
be omitted from the submitted payload as appropriate.
97+
Any packages in the tree that do not have a `version` field in their package.json file will be ignored.
98+
If any `--omit` options are specified (either via the [`--omit` config](/using-npm/config#omit), or one of the shorthands such as `--production`, `--only=dev`, and so on), then packages will be omitted from the submitted payload as appropriate.
11899

119-
If the registry responds with an error, or with an invalid response, then
120-
npm will attempt to load advisory data from the `Quick Audit` endpoint.
100+
If the registry responds with an error, or with an invalid response, then npm will attempt to load advisory data from the `Quick Audit` endpoint.
121101

122-
The expected result will contain a set of advisory objects for each
123-
dependency that matches the advisory range. Each advisory object contains
124-
a `name`, `url`, `id`, `severity`, `vulnerable_versions`, and `title`.
102+
The expected result will contain a set of advisory objects for each dependency that matches the advisory range.
103+
Each advisory object contains a `name`, `url`, `id`, `severity`, `vulnerable_versions`, and `title`.
125104

126-
npm then uses these advisory objects to calculate vulnerabilities and
127-
meta-vulnerabilities of the dependencies within the tree.
105+
npm then uses these advisory objects to calculate vulnerabilities and meta-vulnerabilities of the dependencies within the tree.
128106

129107
#### Quick Audit Endpoint
130108

131-
If the `Bulk Advisory` endpoint returns an error, or invalid data, npm will
132-
attempt to load advisory data from the `Quick Audit` endpoint, which is
133-
considerably slower in most cases.
109+
If the `Bulk Advisory` endpoint returns an error, or invalid data, npm will attempt to load advisory data from the `Quick Audit` endpoint, which is considerably slower in most cases.
134110

135-
The full package tree as found in `package-lock.json` is submitted, along
136-
with the following pieces of additional metadata:
111+
The full package tree as found in `package-lock.json` is submitted, along with the following pieces of additional metadata:
137112

138113
* `npm_version`
139114
* `node_version`
@@ -146,64 +121,42 @@ Omitted dependency types are skipped when generating the report.
146121

147122
#### Scrubbing
148123

149-
Out of an abundance of caution, npm versions 5 and 6 would "scrub" any
150-
packages from the submitted report if their name contained a `/` character,
151-
so as to avoid leaking the names of potentially private packages or git
152-
URLs.
124+
Out of an abundance of caution, npm versions 5 and 6 would "scrub" any packages from the submitted report if their name contained a `/` character, so as to avoid leaking the names of potentially private packages or git URLs.
153125

154-
However, in practice, this resulted in audits often failing to properly
155-
detect meta-vulnerabilities, because the tree would appear to be invalid
156-
due to missing dependencies, and prevented the detection of vulnerabilities
157-
in package trees that used git dependencies or private modules.
126+
However, in practice, this resulted in audits often failing to properly detect meta-vulnerabilities, because the tree would appear to be invalid due to missing dependencies, and prevented the detection of vulnerabilities in package trees that used git dependencies or private modules.
158127

159128
This scrubbing has been removed from npm as of version 7.
160129

161130
#### Calculating Meta-Vulnerabilities and Remediations
162131

163-
npm uses the
164-
[`@npmcli/metavuln-calculator`](http://npm.im/@npmcli/metavuln-calculator)
165-
module to turn a set of security advisories into a set of "vulnerability"
166-
objects. A "meta-vulnerability" is a dependency that is vulnerable by
167-
virtue of dependence on vulnerable versions of a vulnerable package.
132+
npm uses the [`@npmcli/metavuln-calculator`](http://npm.im/@npmcli/metavuln-calculator) module to turn a set of security advisories into a set of "vulnerability" objects.
133+
A "meta-vulnerability" is a dependency that is vulnerable by virtue of dependence on vulnerable versions of a vulnerable package.
168134

169-
For example, if the package `foo` is vulnerable in the range `>=1.0.2
170-
<2.0.0`, and the package `bar` depends on `foo@^1.1.0`, then that version
171-
of `bar` can only be installed by installing a vulnerable version of `foo`.
135+
For example, if the package `foo` is vulnerable in the range `>=1.0.2 <2.0.0`, and the package `bar` depends on `foo@^1.1.0`, then that version of `bar` can only be installed by installing a vulnerable version of `foo`.
172136
In this case, `bar` is a "metavulnerability".
173137

174-
Once metavulnerabilities for a given package are calculated, they are
175-
cached in the `~/.npm` folder and only re-evaluated if the advisory range
176-
changes, or a new version of the package is published (in which case, the
177-
new version is checked for metavulnerable status as well).
138+
Once metavulnerabilities for a given package are calculated, they are cached in the `~/.npm` folder and only re-evaluated if the advisory range changes, or a new version of the package is published (in which case, the new version is checked for metavulnerable status as well).
178139

179-
If the chain of metavulnerabilities extends all the way to the root
180-
project, and it cannot be updated without changing its dependency ranges,
181-
then `npm audit fix` will require the `--force` option to apply the
182-
remediation. If remediations do not require changes to the dependency
183-
ranges, then all vulnerable packages will be updated to a version that does
184-
not have an advisory or metavulnerability posted against it.
140+
If the chain of metavulnerabilities extends all the way to the root project, and it cannot be updated without changing its dependency ranges, then `npm audit fix` will require the `--force` option to apply the remediation.
141+
If remediations do not require changes to the dependency ranges, then all vulnerable packages will be updated to a version that does not have an advisory or metavulnerability posted against it.
185142

186143
### Exit Code
187144

188-
The `npm audit` command will exit with a 0 exit code if no vulnerabilities
189-
were found. The `npm audit fix` command will exit with 0 exit code if no
190-
vulnerabilities are found _or_ if the remediation is able to successfully
191-
fix all vulnerabilities.
145+
The `npm audit` command will exit with a 0 exit code if no vulnerabilities were found.
146+
The `npm audit fix` command will exit with 0 exit code if no vulnerabilities are found _or_ if the remediation is able to successfully fix all vulnerabilities.
192147

193148
If vulnerabilities were found the exit code will depend on the
194149
[`audit-level` config](/using-npm/config#audit-level).
195150

196151
### Examples
197152

198-
Scan your project for vulnerabilities and automatically install any compatible
199-
updates to vulnerable dependencies:
153+
Scan your project for vulnerabilities and automatically install any compatible updates to vulnerable dependencies:
200154

201155
```bash
202156
$ npm audit fix
203157
```
204158

205-
Run `audit fix` without modifying `node_modules`, but still updating the
206-
pkglock:
159+
Run `audit fix` without modifying `node_modules`, but still updating the pkglock:
207160

208161
```bash
209162
$ npm audit fix --package-lock-only
@@ -215,22 +168,19 @@ Skip updating `devDependencies`:
215168
$ npm audit fix --only=prod
216169
```
217170

218-
Have `audit fix` install SemVer-major updates to toplevel dependencies, not
219-
just SemVer-compatible ones:
171+
Have `audit fix` install SemVer-major updates to toplevel dependencies, not just SemVer-compatible ones:
220172

221173
```bash
222174
$ npm audit fix --force
223175
```
224176

225-
Do a dry run to get an idea of what `audit fix` will do, and _also_ output
226-
install information in JSON format:
177+
Do a dry run to get an idea of what `audit fix` will do, and _also_ output install information in JSON format:
227178

228179
```bash
229180
$ npm audit fix --dry-run --json
230181
```
231182

232-
Scan your project for vulnerabilities and just show the details, without
233-
fixing anything:
183+
Scan your project for vulnerabilities and just show the details, without fixing anything:
234184

235185
```bash
236186
$ npm audit

docs/lib/content/commands/npm-bugs.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ description: Report bugs for a package in a web browser
1010

1111
### Description
1212

13-
This command tries to guess at the likely location of a package's bug
14-
tracker URL or the `mailto` URL of the support email, and then tries to
15-
open it using the [`--browser` config](/using-npm/config#browser) param. If no
16-
package name is provided, it will search for a `package.json` in the current
17-
folder and use the `name` property.
13+
This command tries to guess at the likely location of a package's bug tracker URL or the `mailto` URL of the support email, and then tries to open it using the [`--browser` config](/using-npm/config#browser) param.
14+
If no package name is provided, it will search for a `package.json` in the current folder and use the `name` property.
1815

1916
### Configuration
2017

0 commit comments

Comments
 (0)