Skip to content

Commit 09df82c

Browse files
committed
doc: corrections and updates to shrinkwrap and package.json docs
1 parent 03ccc97 commit 09df82c

File tree

9 files changed

+487
-572
lines changed

9 files changed

+487
-572
lines changed

docs/content/commands/npm-audit.md

-1
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,4 @@ $ npm audit --audit-level=moderate
190190
### See Also
191191

192192
* [npm install](/commands/npm-install)
193-
* [package-locks](/configuring-npm/package-locks)
194193
* [config](/using-npm/config)

docs/content/commands/npm-ci.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ cache:
6868
### See Also
6969

7070
* [npm install](/commands/npm-install)
71-
* [package-locks](/configuring-npm/package-locks)
71+
* [package-lock.json](/configuring-npm/package-lock-json)

docs/content/commands/npm-shrinkwrap.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ npm shrinkwrap
1313
### Description
1414

1515
This command repurposes `package-lock.json` into a publishable
16-
`npm-shrinkwrap.json` or simply creates a new one. The file created and updated
17-
by this command will then take precedence over any other existing or future
18-
`package-lock.json` files. For a detailed explanation of the design and purpose
19-
of package locks in npm, see [package-locks](/configuring-npm/package-locks).
16+
`npm-shrinkwrap.json` or simply creates a new one. The file created and
17+
updated by this command will then take precedence over any other existing
18+
or future `package-lock.json` files. For a detailed explanation of the
19+
design and purpose of package locks in npm, see
20+
[package-lock-json](/configuring-npm/package-lock-json).
2021

2122
### See Also
2223

2324
* [npm install](/commands/npm-install)
2425
* [npm run-script](/commands/npm-run-script)
2526
* [npm scripts](/using-npm/scripts)
26-
* [package.js](/configuring-npm/package-json)
27-
* [package-locks](/configuring-npm/package-locks)
27+
* [package.json](/configuring-npm/package-json)
2828
* [package-lock.json](/configuring-npm/package-lock-json)
29-
* [shrinkwrap.json](/configuring-npm/shrinkwrap-json)
29+
* [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json)
3030
* [npm ls](/commands/npm-ls)

docs/content/configuring-npm/install.md

+37-16
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,27 @@ description: Download and install node and npm
66

77
### Description
88

9-
To publish and install packages to and from the public npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. **We strongly recommend using a Node version manager to install Node.js and npm.** We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.
9+
To publish and install packages to and from the public npm registry, you
10+
must install Node.js and the npm command line interface using either a Node
11+
version manager or a Node installer. **We strongly recommend using a Node
12+
version manager to install Node.js and npm.** We do not recommend using a
13+
Node installer, since the Node installation process installs npm in a
14+
directory with local permissions and can cause permissions errors when you
15+
run npm packages globally.
1016

1117
### Overview
1218

13-
- [Checking your version of npm and Node.js](#checking-your-version-of-npm-and-node-js)
14-
- [Using a Node version manager to install Node.js and npm](#using-a-node-version-manager-to-install-node-js-and-npm)
15-
- [Using a Node installer to install Node.js and npm](#using-a-node-installer-to-install-node-js-and-npm)
19+
- [Checking your version of npm and
20+
Node.js](#checking-your-version-of-npm-and-node-js)
21+
- [Using a Node version manager to install Node.js and
22+
npm](#using-a-node-version-manager-to-install-node-js-and-npm)
23+
- [Using a Node installer to install Node.js and
24+
npm](#using-a-node-installer-to-install-node-js-and-npm)
1625

1726
### Checking your version of npm and Node.js
1827

19-
To see if you already have Node.js and npm installed and check the installed version, run the following commands:
28+
To see if you already have Node.js and npm installed and check the
29+
installed version, run the following commands:
2030

2131
```
2232
node -v
@@ -25,7 +35,10 @@ npm -v
2535

2636
### Using a Node version manager to install Node.js and npm
2737

28-
Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.
38+
Node version managers allow you to install and switch between multiple
39+
versions of Node.js and npm on your system so you can test your
40+
applications on multiple versions of npm to ensure they work for users on
41+
different versions.
2942

3043
#### OSX or Linux Node version managers
3144

@@ -39,28 +52,36 @@ Node version managers allow you to install and switch between multiple versions
3952

4053
### Using a Node installer to install Node.js and npm
4154

42-
If you are unable to use a Node version manager, you can use a Node installer to install both Node.js and npm on your system.
55+
If you are unable to use a Node version manager, you can use a Node
56+
installer to install both Node.js and npm on your system.
4357

4458
* [Node.js installer](https://nodejs.org/en/download/)
45-
* [NodeSource installer](https://github.com/nodesource/distributions). If you use Linux, we recommend that you use a NodeSource installer.
59+
* [NodeSource installer](https://github.com/nodesource/distributions). If
60+
you use Linux, we recommend that you use a NodeSource installer.
4661

4762
#### OS X or Windows Node installers
4863

49-
If you're using OS X or Windows, use one of the installers from the [Node.js download page](https://nodejs.org/en/download/). Be sure to install the version labeled **LTS**. Other versions have not yet been tested with npm.
64+
If you're using OS X or Windows, use one of the installers from the
65+
[Node.js download page](https://nodejs.org/en/download/). Be sure to
66+
install the version labeled **LTS**. Other versions have not yet been
67+
tested with npm.
5068

5169
#### Linux or other operating systems Node installers
5270

53-
If you're using Linux or another operating system, use one of the following installers:
71+
If you're using Linux or another operating system, use one of the following
72+
installers:
5473

55-
- [NodeSource installer](https://github.com/nodesource/distributions) (recommended)
56-
- One of the installers on the [Node.js download page](https://nodejs.org/en/download/)
57-
58-
Or see [this page](https://nodejs.org/en/download/package-manager/) to install npm for Linux in the way many Linux developers prefer.
74+
- [NodeSource installer](https://github.com/nodesource/distributions)
75+
(recommended)
76+
- One of the installers on the [Node.js download
77+
page](https://nodejs.org/en/download/)
5978

79+
Or see [this page](https://nodejs.org/en/download/package-manager/) to
80+
install npm for Linux in the way many Linux developers prefer.
6081

6182
#### Less-common operating systems
6283

63-
For more information on installing Node.js on a variety of operating systems, see [this page][pkg-mgr].
64-
84+
For more information on installing Node.js on a variety of operating
85+
systems, see [this page][pkg-mgr].
6586

6687
[pkg-mgr]: https://nodejs.org/en/download/package-manager/

docs/content/configuring-npm/shrinkwrap-json.md renamed to docs/content/configuring-npm/npm-shrinkwrap-json.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ strongly discouraged for library authors to publish this file, since that
1818
would prevent end users from having control over transitive dependency
1919
updates.
2020

21-
Additionally, if both `package-lock.json` and `npm-shrinkwrap.json` are
22-
present in a package root, `package-lock.json` will be preferred over
23-
this file.
21+
If both `package-lock.json` and `npm-shrinkwrap.json` are present in a
22+
package root, `npm-shrinkwrap.json` will be preferred over the
23+
`package-lock.json` file.
2424

2525
For full details and description of the `npm-shrinkwrap.json` file format,
2626
refer to the manual page for

docs/content/configuring-npm/npmrc.md

+27-26
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ description: The npm config files
66

77
### Description
88

9-
npm gets its config settings from the command line, environment
10-
variables, and `npmrc` files.
9+
npm gets its config settings from the command line, environment variables,
10+
and `npmrc` files.
1111

12-
The `npm config` command can be used to update and edit the contents
13-
of the user and global npmrc files.
12+
The `npm config` command can be used to update and edit the contents of the
13+
user and global npmrc files.
1414

15-
For a list of available configuration options, see [config](/using-npm/config).
15+
For a list of available configuration options, see
16+
[config](/using-npm/config).
1617

1718
### Files
1819

@@ -23,20 +24,19 @@ The four relevant files are:
2324
* global config file ($PREFIX/etc/npmrc)
2425
* npm builtin config file (/path/to/npm/npmrc)
2526

26-
All npm config files are an ini-formatted list of `key = value`
27-
parameters. Environment variables can be replaced using
28-
`${VARIABLE_NAME}`. For example:
27+
All npm config files are an ini-formatted list of `key = value` parameters.
28+
Environment variables can be replaced using `${VARIABLE_NAME}`. For
29+
example:
2930

3031
```bash
3132
prefix = ${HOME}/.npm-packages
3233
```
3334

34-
Each of these files is loaded, and config options are resolved in
35-
priority order. For example, a setting in the userconfig file would
36-
override the setting in the globalconfig file.
35+
Each of these files is loaded, and config options are resolved in priority
36+
order. For example, a setting in the userconfig file would override the
37+
setting in the globalconfig file.
3738

38-
Array values are specified by adding "[]" after the key name. For
39-
example:
39+
Array values are specified by adding "[]" after the key name. For example:
4040

4141
```bash
4242
key[] = "first value"
@@ -45,7 +45,9 @@ key[] = "second value"
4545

4646
#### Comments
4747

48-
Lines in `.npmrc` files are interpreted as comments when they begin with a `;` or `#` character. `.npmrc` files are parsed by [npm/ini](https://github.com/npm/ini), which specifies this comment syntax.
48+
Lines in `.npmrc` files are interpreted as comments when they begin with a
49+
`;` or `#` character. `.npmrc` files are parsed by
50+
[npm/ini](https://github.com/npm/ini), which specifies this comment syntax.
4951

5052
For example:
5153

@@ -61,34 +63,33 @@ When working locally in a project, a `.npmrc` file in the root of the
6163
project (ie, a sibling of `node_modules` and `package.json`) will set
6264
config values specific to this project.
6365

64-
Note that this only applies to the root of the project that you're
65-
running npm in. It has no effect when your module is published. For
66-
example, you can't publish a module that forces itself to install
67-
globally, or in a different location.
66+
Note that this only applies to the root of the project that you're running
67+
npm in. It has no effect when your module is published. For example, you
68+
can't publish a module that forces itself to install globally, or in a
69+
different location.
6870

6971
Additionally, this file is not read in global mode, such as when running
7072
`npm install -g`.
7173

7274
#### Per-user config file
7375

74-
`$HOME/.npmrc` (or the `userconfig` param, if set in the environment
75-
or on the command line)
76+
`$HOME/.npmrc` (or the `userconfig` param, if set in the environment or on
77+
the command line)
7678

7779
#### Global config file
7880

79-
`$PREFIX/etc/npmrc` (or the `globalconfig` param, if set above):
80-
This file is an ini-file formatted list of `key = value` parameters.
81-
Environment variables can be replaced as above.
81+
`$PREFIX/etc/npmrc` (or the `globalconfig` param, if set above): This file
82+
is an ini-file formatted list of `key = value` parameters. Environment
83+
variables can be replaced as above.
8284

8385
#### Built-in config file
8486

8587
`path/to/npm/itself/npmrc`
8688

8789
This is an unchangeable "builtin" configuration file that npm keeps
8890
consistent across updates. Set fields in here using the `./configure`
89-
script that comes with npm. This is primarily for distribution
90-
maintainers to override default configs in a standard and consistent
91-
manner.
91+
script that comes with npm. This is primarily for distribution maintainers
92+
to override default configs in a standard and consistent manner.
9293

9394
### See also
9495

0 commit comments

Comments
 (0)