Skip to content

Commit c94b56b

Browse files
committed
chore: Unwrap markdown docs
Signed-off-by: Josh Soref <[email protected]>
1 parent 2b6941b commit c94b56b

Some content is hidden

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

63 files changed

+508
-1164
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +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.
15-
If no registry is specified, the default registry
16-
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)).
1715

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

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

2421
### Configuration
2522

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

Lines changed: 40 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +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.
16-
If any vulnerabilities are found, then the impact and
17-
appropriate remediation will be calculated.
18-
If the `fix` argument is
19-
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.
2016

2117
The command will exit with a 0 exit code if no vulnerabilities were found.
2218

23-
Note that some vulnerabilities cannot be fixed automatically and will
24-
require manual intervention or review.
25-
Also note that since `npm audit
26-
fix` runs a full-fledged `npm install` under the hood, all configs that
27-
apply to the installer will also apply to `npm install` -- so things like
28-
`npm audit fix --package-lock-only` will work as expected.
29-
30-
By default, the audit command will exit with a non-zero code if any
31-
vulnerability is found.
32-
It may be useful in CI environments to include the
33-
`--audit-level` parameter to specify the minimum vulnerability level that
34-
will cause the command to fail.
35-
This option does not filter the report
36-
output, it simply changes the command's failure threshold.
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.
21+
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.
3725

3826
### Package lock
3927

40-
By default npm requires a package-lock or shrinkwrap in order to run the
41-
audit.
42-
You can bypass the package lock with `--no-package-lock` but be
43-
aware the results may be different with every run, since npm will
44-
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.
4530

4631
### Audit Signatures
4732

@@ -53,14 +38,9 @@ Registry signatures can be verified using the following `audit` command:
5338
$ npm audit signatures
5439
```
5540

56-
The `audit signatures` command will also verify the provenance attestations of
57-
downloaded packages.
58-
Because provenance attestations are such a new feature,
59-
security features may be added to (or changed in) the attestation format over
60-
time.
61-
To ensure that you're always able to verify attestation signatures check
62-
that you're running the latest version of the npm CLI. Please note this often
63-
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.
6444

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

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

10787
### Audit Endpoints
10888

109-
There are two audit endpoints that npm may use to fetch vulnerability
110-
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.
11190

11291
#### Bulk Advisory Endpoint
11392

114-
As of version 7, npm uses the much faster `Bulk Advisory` endpoint to
115-
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.
11694

117-
npm will generate a JSON payload with the name and list of versions of each
118-
package in the tree, and POST it to the default configured registry at
119-
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`.
12096

121-
Any packages in the tree that do not have a `version` field in their
122-
package.json file will be ignored.
123-
If any `--omit` options are specified
124-
(either via the [`--omit` config](/using-npm/config#omit), or one of the
125-
shorthands such as `--production`, `--only=dev`, and so on), then packages will
126-
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.
12799

128-
If the registry responds with an error, or with an invalid response, then
129-
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.
130101

131-
The expected result will contain a set of advisory objects for each
132-
dependency that matches the advisory range.
133-
Each advisory object contains
134-
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`.
135104

136-
npm then uses these advisory objects to calculate vulnerabilities and
137-
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.
138106

139107
#### Quick Audit Endpoint
140108

141-
If the `Bulk Advisory` endpoint returns an error, or invalid data, npm will
142-
attempt to load advisory data from the `Quick Audit` endpoint, which is
143-
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.
144110

145-
The full package tree as found in `package-lock.json` is submitted, along
146-
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:
147112

148113
* `npm_version`
149114
* `node_version`
@@ -156,67 +121,42 @@ Omitted dependency types are skipped when generating the report.
156121

157122
#### Scrubbing
158123

159-
Out of an abundance of caution, npm versions 5 and 6 would "scrub" any
160-
packages from the submitted report if their name contained a `/` character,
161-
so as to avoid leaking the names of potentially private packages or git
162-
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.
163125

164-
However, in practice, this resulted in audits often failing to properly
165-
detect meta-vulnerabilities, because the tree would appear to be invalid
166-
due to missing dependencies, and prevented the detection of vulnerabilities
167-
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.
168127

169128
This scrubbing has been removed from npm as of version 7.
170129

171130
#### Calculating Meta-Vulnerabilities and Remediations
172131

173-
npm uses the
174-
[`@npmcli/metavuln-calculator`](http://npm.im/@npmcli/metavuln-calculator)
175-
module to turn a set of security advisories into a set of "vulnerability"
176-
objects.
177-
A "meta-vulnerability" is a dependency that is vulnerable by
178-
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.
179134

180-
For example, if the package `foo` is vulnerable in the range `>=1.0.2
181-
<2.0.0`, and the package `bar` depends on `foo@^1.1.0`, then that version
182-
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`.
183136
In this case, `bar` is a "metavulnerability".
184137

185-
Once metavulnerabilities for a given package are calculated, they are
186-
cached in the `~/.npm` folder and only re-evaluated if the advisory range
187-
changes, or a new version of the package is published (in which case, the
188-
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).
189139

190-
If the chain of metavulnerabilities extends all the way to the root
191-
project, and it cannot be updated without changing its dependency ranges,
192-
then `npm audit fix` will require the `--force` option to apply the
193-
remediation.
194-
If remediations do not require changes to the dependency
195-
ranges, then all vulnerable packages will be updated to a version that does
196-
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.
197142

198143
### Exit Code
199144

200-
The `npm audit` command will exit with a 0 exit code if no vulnerabilities
201-
were found.
202-
The `npm audit fix` command will exit with 0 exit code if no
203-
vulnerabilities are found _or_ if the remediation is able to successfully
204-
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.
205147

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

209151
### Examples
210152

211-
Scan your project for vulnerabilities and automatically install any compatible
212-
updates to vulnerable dependencies:
153+
Scan your project for vulnerabilities and automatically install any compatible updates to vulnerable dependencies:
213154

214155
```bash
215156
$ npm audit fix
216157
```
217158

218-
Run `audit fix` without modifying `node_modules`, but still updating the
219-
pkglock:
159+
Run `audit fix` without modifying `node_modules`, but still updating the pkglock:
220160

221161
```bash
222162
$ npm audit fix --package-lock-only
@@ -228,22 +168,19 @@ Skip updating `devDependencies`:
228168
$ npm audit fix --only=prod
229169
```
230170

231-
Have `audit fix` install SemVer-major updates to toplevel dependencies, not
232-
just SemVer-compatible ones:
171+
Have `audit fix` install SemVer-major updates to toplevel dependencies, not just SemVer-compatible ones:
233172

234173
```bash
235174
$ npm audit fix --force
236175
```
237176

238-
Do a dry run to get an idea of what `audit fix` will do, and _also_ output
239-
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:
240178

241179
```bash
242180
$ npm audit fix --dry-run --json
243181
```
244182

245-
Scan your project for vulnerabilities and just show the details, without
246-
fixing anything:
183+
Scan your project for vulnerabilities and just show the details, without fixing anything:
247184

248185
```bash
249186
$ npm audit

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +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.
16-
If no
17-
package name is provided, it will search for a `package.json` in the current
18-
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.
1915

2016
### Configuration
2117

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ The npm cache is strictly a cache: it should not be relied upon as a persistent
6161
npm makes no guarantee that a previously-cached piece of data will be available later, and will automatically delete corrupted contents.
6262
The primary guarantee that the cache makes is that, if it does return data, that data will be exactly the data that was inserted.
6363

64-
To run an offline verification of existing cache contents, use `npm cache
65-
verify`.
64+
To run an offline verification of existing cache contents, use `npm cache verify`.
6665

6766
### Configuration
6867

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ description: Clean install a project
1010

1111
### Description
1212

13-
This command is similar to [`npm install`](/commands/npm-install), except
14-
it's meant to be used in automated environments such as test platforms,
15-
continuous integration, and deployment -- or any situation where you want
16-
to make sure you're doing a clean install of your dependencies.
13+
This command is similar to [`npm install`](/commands/npm-install), except it's meant to be used in automated environments such as test platforms,
14+
continuous integration, and deployment -- or any situation where you want to make sure you're doing a clean install of your dependencies.
1715

1816
The main differences between using `npm install` and `npm ci` are:
1917

@@ -30,10 +28,8 @@ The main differences between using `npm install` and `npm ci` are:
3028

3129
NOTE: If you create your `package-lock.json` file by running `npm install`
3230
with flags that can affect the shape of your dependency tree, such as
33-
`--legacy-peer-deps` or `--install-links`, you _must_ provide the same
34-
flags to `npm ci` or you are likely to encounter errors.
35-
An easy way to do
36-
this is to run, for example,
31+
`--legacy-peer-deps` or `--install-links`, you _must_ provide the same flags to `npm ci` or you are likely to encounter errors.
32+
An easy way to do this is to run, for example,
3733
`npm config set legacy-peer-deps=true --location=project` and commit the
3834
`.npmrc` file to your repo.
3935

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,19 @@ description: Tab Completion for npm
1212

1313
Enables tab-completion in all npm commands.
1414

15-
The synopsis above
16-
loads the completions into your current shell.
17-
Adding it to
18-
your ~/.bashrc or ~/.zshrc will make the completions available
19-
everywhere:
15+
The synopsis above loads the completions into your current shell.
16+
Adding it to your ~/.bashrc or ~/.zshrc will make the completions available everywhere:
2017

2118
```bash
2219
npm completion >> ~/.bashrc
2320
npm completion >> ~/.zshrc
2421
```
2522

26-
You may of course also pipe the output of `npm completion` to a file
27-
such as `/usr/local/etc/bash_completion.d/npm` or
23+
You may of course also pipe the output of `npm completion` to a file such as `/usr/local/etc/bash_completion.d/npm` or
2824
`/etc/bash_completion.d/npm` if you have a system that will read
2925
that file for you.
3026

31-
When `COMP_CWORD`, `COMP_LINE`, and `COMP_POINT` are defined in the
32-
environment, `npm completion` acts in "plumbing mode", and outputs
33-
completions based on the arguments.
27+
When `COMP_CWORD`, `COMP_LINE`, and `COMP_POINT` are defined in the environment, `npm completion` acts in "plumbing mode", and outputs completions based on the arguments.
3428

3529
### See Also
3630

0 commit comments

Comments
 (0)