CLI documentation update from CI
CI User committed
Jul 16, 2021 at 02:26 UTC
203783dbadd6a6670612ff2ac7e03ae1dacc247c
32 files changed
+428
-33
cli/v7
+1
-1
@@ -1 +1 @@
1
-Subproject commit 665a7bde900d7fbf46aca609b0b9c92b5508a3ea
1
+Subproject commit 1a2159d3cf2513e77e728e7feeaa04ad150d3812
content/cli/v7/commands/npm-audit.md
+4
@@ -242,6 +242,7 @@ mistakes, unnecessary performance degradation, and malicious input.
242
* Allow unpublishing all versions of a published package.
243
* Allow conflicting peerDependencies to be installed in the root project.
244
* Implicitly set `--yes` during `npm init`.
245
+* Allow clobbering existing values in `npm pkg`
246
247
If you don't have a clear idea of what you want to do, it is strongly
248
recommended that you do not use this option!
@@ -253,6 +254,9 @@ recommended that you do not use this option!
254
255
Whether or not to output JSON data, rather than the normal output.
256
257
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
258
+ saving them to your `package.json`.
259
+
260
Not supported by all npm commands.
261
262
#### `package-lock-only`
content/cli/v7/commands/npm-ci.md
+10
@@ -79,6 +79,16 @@ cache:
79
80
<!-- AUTOGENERATED CONFIG DESCRIPTIONS START -->
81
<!-- automatically generated, do not edit manually -->
82
+#### `audit`
83
+
84
+* Default: true
85
+* Type: Boolean
86
+
87
+When "true" submit audit reports alongside the current npm command to the
88
+default registry and all registries configured for scopes. See the
89
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
90
+submitted.
91
+
92
#### `ignore-scripts`
93
94
* Default: false
content/cli/v7/commands/npm-config.md
+11
@@ -114,6 +114,9 @@ global config.
114
115
Whether or not to output JSON data, rather than the normal output.
116
117
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
118
+ saving them to your `package.json`.
119
+
120
Not supported by all npm commands.
121
122
#### `global`
@@ -138,6 +141,14 @@ folder instead of the current working directory. See
141
142
The command to run for `npm edit` and `npm config edit`.
143
144
+#### `location`
145
+
146
+* Default: "user" unless `--global` is passed, which will also set this value
147
+ to "global"
148
+* Type: "global", "user", or "project"
149
+
150
+When passed to `npm config` this refers to which config file to use.
151
+
152
#### `long`
153
154
* Default: false
content/cli/v7/commands/npm-dedupe.md
+4
-3
@@ -174,9 +174,10 @@ will *not* run any pre- or post-scripts.
174
* Default: true
175
* Type: Boolean
176
177
-When "true" submit audit reports alongside `npm install` runs to the default
178
-registry and all registries configured for scopes. See the documentation for
179
-[`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.
177
+When "true" submit audit reports alongside the current npm command to the
178
+default registry and all registries configured for scopes. See the
179
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
180
+submitted.
181
182
#### `bin-links`
183
content/cli/v7/commands/npm-explain.md
+3
@@ -73,6 +73,9 @@ node_modules/nyc/node_modules/find-up
73
74
Whether or not to output JSON data, rather than the normal output.
75
76
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
77
+ saving them to your `package.json`.
78
+
79
Not supported by all npm commands.
80
81
#### `workspace`
content/cli/v7/commands/npm-find-dupes.md
+4
-3
@@ -117,9 +117,10 @@ will *not* run any pre- or post-scripts.
117
* Default: true
118
* Type: Boolean
119
120
-When "true" submit audit reports alongside `npm install` runs to the default
121
-registry and all registries configured for scopes. See the documentation for
122
-[`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.
120
+When "true" submit audit reports alongside the current npm command to the
121
+default registry and all registries configured for scopes. See the
122
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
123
+submitted.
124
125
#### `bin-links`
126
content/cli/v7/commands/npm-fund.md
+3
@@ -83,6 +83,9 @@ test-workspaces-fund@1.0.0
83
84
Whether or not to output JSON data, rather than the normal output.
85
86
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
87
+ saving them to your `package.json`.
88
+
89
Not supported by all npm commands.
90
91
#### `browser`
content/cli/v7/commands/npm-init.md
+1
@@ -185,6 +185,7 @@ mistakes, unnecessary performance degradation, and malicious input.
185
* Allow unpublishing all versions of a published package.
186
* Allow conflicting peerDependencies to be installed in the root project.
187
* Implicitly set `--yes` during `npm init`.
188
+* Allow clobbering existing values in `npm pkg`
189
190
If you don't have a clear idea of what you want to do, it is strongly
191
recommended that you do not use this option!
content/cli/v7/commands/npm-install-ci-test.md
+10
@@ -30,6 +30,16 @@ This command runs `npm ci` followed immediately by `npm test`.
30
31
<!-- AUTOGENERATED CONFIG DESCRIPTIONS START -->
32
<!-- automatically generated, do not edit manually -->
33
+#### `audit`
34
+
35
+* Default: true
36
+* Type: Boolean
37
+
38
+When "true" submit audit reports alongside the current npm command to the
39
+default registry and all registries configured for scopes. See the
40
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
41
+submitted.
42
+
43
#### `ignore-scripts`
44
45
* Default: false
content/cli/v7/commands/npm-install-test.md
+4
-3
@@ -159,9 +159,10 @@ will *not* run any pre- or post-scripts.
159
* Default: true
160
* Type: Boolean
161
162
-When "true" submit audit reports alongside `npm install` runs to the default
163
-registry and all registries configured for scopes. See the documentation for
164
-[`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.
162
+When "true" submit audit reports alongside the current npm command to the
163
+default registry and all registries configured for scopes. See the
164
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
165
+submitted.
166
167
#### `bin-links`
168
content/cli/v7/commands/npm-install.md
+4
-3
@@ -544,9 +544,10 @@ will *not* run any pre- or post-scripts.
544
* Default: true
545
* Type: Boolean
546
547
-When "true" submit audit reports alongside `npm install` runs to the default
548
-registry and all registries configured for scopes. See the documentation for
549
-[`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.
547
+When "true" submit audit reports alongside the current npm command to the
548
+default registry and all registries configured for scopes. See the
549
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
550
+submitted.
551
552
#### `bin-links`
553
content/cli/v7/commands/npm-link.md
+4
-3
@@ -243,9 +243,10 @@ will *not* run any pre- or post-scripts.
243
* Default: true
244
* Type: Boolean
245
246
-When "true" submit audit reports alongside `npm install` runs to the default
247
-registry and all registries configured for scopes. See the documentation for
248
-[`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.
246
+When "true" submit audit reports alongside the current npm command to the
247
+default registry and all registries configured for scopes. See the
248
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
249
+submitted.
250
251
#### `bin-links`
252
content/cli/v7/commands/npm-ls.md
+3
@@ -101,6 +101,9 @@ upon by the current project.
101
102
Whether or not to output JSON data, rather than the normal output.
103
104
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
105
+ saving them to your `package.json`.
106
+
107
Not supported by all npm commands.
108
109
#### `long`
content/cli/v7/commands/npm-org.md
+3
@@ -97,6 +97,9 @@ password, npm will prompt on the command line for one.
97
98
Whether or not to output JSON data, rather than the normal output.
99
100
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
101
+ saving them to your `package.json`.
102
+
103
Not supported by all npm commands.
104
105
#### `parseable`
content/cli/v7/commands/npm-outdated.md
+3
@@ -114,6 +114,9 @@ upon by the current project.
114
115
Whether or not to output JSON data, rather than the normal output.
116
117
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
118
+ saving them to your `package.json`.
119
+
120
Not supported by all npm commands.
121
122
#### `long`
content/cli/v7/commands/npm-pack.md
+3
@@ -44,6 +44,9 @@ Note: This is NOT honored by other network related commands, eg `dist-tags`,
44
45
Whether or not to output JSON data, rather than the normal output.
46
47
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
48
+ saving them to your `package.json`.
49
+
50
Not supported by all npm commands.
51
52
#### `pack-destination`
content/cli/v7/commands/npm-pkg.md
new
+255
@@ -0,0 +1,255 @@
1
+---
2
+title: npm-pkg
3
+section: 1
4
+description: Manages your package.json
5
+redirect_from:
6
+ - /cli/pkg
7
+ - /cli/pkg.html
8
+ - /cli/commands/pkg
9
+ - /cli-commands/pkg
10
+ - /cli-commands/pkg.html
11
+ - /cli-commands/npm-pkg
12
+github_repo: npm/cli
13
+github_branch: latest
14
+github_path: docs/content/commands/npm-pkg.md
15
+---
16
+
17
+### Synopsis
18
+
19
+```bash
20
+npm pkg get [<field> [.<subfield> ...]]
21
+npm pkg set <field>=<value> [.<subfield>=<value> ...]
22
+npm pkg delete <field> [.<subfield> ...]
23
+```
24
+
25
+### Description
26
+
27
+A command that automates the management of `package.json` files.
28
+`npm pkg` provide 3 different sub commands that allow you to modify or retrieve
29
+values for given object keys in your `packge.json`.
30
+
31
+The syntax to retrieve and set fields is a dot separated representation of
32
+the nested object properties to be found within your `package.json`, it's the
33
+same notation used in [`npm view`](/cli/v7/commands/npm-view) to retrieve information
34
+from the registry manifest, below you can find more examples on how to use it.
35
+
36
+Returned values are always in **json** format.
37
+
38
+* `npm pkg get <field>`
39
+
40
+ Retrieves a value `key`, defined in your `package.json` file.
41
+
42
+ For example, in order to retrieve the name of the current package, you
43
+ can run:
44
+
45
+ ```bash
46
+ npm pkg get name
47
+ ```
48
+
49
+ It's also possible to retrieve multiple values at once:
50
+
51
+ ```bash
52
+ npm pkg get name version
53
+ ```
54
+
55
+ You can view child fields by separating them with a period. To retrieve
56
+ the value of a test `script` value, you would run the following command:
57
+
58
+ ```bash
59
+ npm pkg get scripts.test
60
+ ```
61
+
62
+ For fields that are arrays, requesting a non-numeric field will return
63
+ all of the values from the objects in the list. For example, to get all
64
+ the contributor emails for a package, you would run:
65
+
66
+ ```bash
67
+ npm pkg get contributors.email
68
+ ```
69
+
70
+ You may also use numeric indices in square braces to specifically select
71
+ an item in an array field. To just get the email address of the first
72
+ contributor in the list, you can run:
73
+
74
+ ```bash
75
+ npm pkg get contributors[0].email
76
+ ```
77
+
78
+* `npm pkg set <field>=<value>`
79
+
80
+ Sets a `value` in your `package.json` based on the `field` value. When
81
+ saving to your `package.json` file the same set of rules used during
82
+ `npm install` and other cli commands that touches the `package.json` file
83
+ are used, making sure to respect the existing indentation and possibly
84
+ applying some validation prior to saving values to the file.
85
+
86
+ The same syntax used to retrieve values from your package can also be used
87
+ to define new properties or overriding existing ones, below are some
88
+ examples of how the dot separated syntax can be used to edit your
89
+ `package.json` file.
90
+
91
+ Defining a new bin named `mynewcommand` in your `package.json` that points
92
+ to a file `cli.js`:
93
+
94
+ ```bash
95
+ npm pkg set bin.mynewcommand=cli.js
96
+ ```
97
+
98
+ Setting multiple fields at once is also possible:
99
+
100
+ ```bash
101
+ npm pkg set description='Awesome package' engines.node='>=10'
102
+ ```
103
+
104
+ It's also possible to add to array values, for example to add a new
105
+ contributor entry:
106
+
107
+ ```bash
108
+ npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca'
109
+ ```
110
+
111
+ You may also append items to the end of an array using the special
112
+ empty bracket notation:
113
+
114
+ ```bash
115
+ npm pkg set contributors[].name='Foo' contributors[].name='Bar'
116
+ ```
117
+
118
+ It's also possible to parse values as json prior to saving them to your
119
+ `package.json` file, for example in order to set a `"private": true`
120
+ property:
121
+
122
+ ```bash
123
+ npm pkg set private=true --json
124
+ ```
125
+
126
+ It also enables saving values as numbers:
127
+
128
+ ```bash
129
+ npm pkg set tap.timeout=60 --json
130
+ ```
131
+
132
+* `npm pkg delete <key>`
133
+
134
+ Deletes a `key` from your `package.json`
135
+
136
+ The same syntax used to set values from your package can also be used
137
+ to remove existing ones. For example, in order to remove a script named
138
+ build:
139
+
140
+ ```bash
141
+ npm pkg delete scripts.build
142
+ ```
143
+
144
+### Workspaces support
145
+
146
+You can set/get/delete items across your configured workspaces by using the
147
+`workspace` or `workspaces` config options.
148
+
149
+For example, setting a `funding` value across all configured workspaces
150
+of a project:
151
+
152
+```bash
153
+npm pkg set funding=https://example.com --ws
154
+```
155
+
156
+When using `npm pkg get` to retrieve info from your configured workspaces, the
157
+returned result will be in a json format in which top level keys are the
158
+names of each workspace, the values of these keys will be the result values
159
+returned from each of the configured workspaces, e.g:
160
+
161
+```
162
+npm pkg get name version --ws
163
+{
164
+ "a": {
165
+ "name": "a",
166
+ "version": "1.0.0"
167
+ },
168
+ "b": {
169
+ "name": "b",
170
+ "version": "1.0.0"
171
+ }
172
+}
173
+```
174
+
175
+### Configuration
176
+
177
+<!-- AUTOGENERATED CONFIG DESCRIPTIONS START -->
178
+<!-- automatically generated, do not edit manually -->
179
+#### `force`
180
+
181
+* Default: false
182
+* Type: Boolean
183
+
184
+Removes various protections against unfortunate side effects, common
185
+mistakes, unnecessary performance degradation, and malicious input.
186
+
187
+* Allow clobbering non-npm files in global installs.
188
+* Allow the `npm version` command to work on an unclean git repository.
189
+* Allow deleting the cache folder with `npm cache clean`.
190
+* Allow installing packages that have an `engines` declaration requiring a
191
+ different version of npm.
192
+* Allow installing packages that have an `engines` declaration requiring a
193
+ different version of `node`, even if `--engine-strict` is enabled.
194
+* Allow `npm audit fix` to install modules outside your stated dependency
195
+ range (including SemVer-major changes).
196
+* Allow unpublishing all versions of a published package.
197
+* Allow conflicting peerDependencies to be installed in the root project.
198
+* Implicitly set `--yes` during `npm init`.
199
+* Allow clobbering existing values in `npm pkg`
200
+
201
+If you don't have a clear idea of what you want to do, it is strongly
202
+recommended that you do not use this option!
203
+
204
+#### `json`
205
+
206
+* Default: false
207
+* Type: Boolean
208
+
209
+Whether or not to output JSON data, rather than the normal output.
210
+
211
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
212
+ saving them to your `package.json`.
213
+
214
+Not supported by all npm commands.
215
+
216
+#### `workspace`
217
+
218
+* Default:
219
+* Type: String (can be set multiple times)
220
+
221
+Enable running a command in the context of the configured workspaces of the
222
+current project while filtering by running only the workspaces defined by
223
+this configuration option.
224
+
225
+Valid values for the `workspace` config are either:
226
+
227
+* Workspace names
228
+* Path to a workspace directory
229
+* Path to a parent workspace directory (will result to selecting all of the
230
+ nested workspaces)
231
+
232
+When set for the `npm init` command, this may be set to the folder of a
233
+workspace which does not yet exist, to create the folder and set it up as a
234
+brand new workspace within the project.
235
+
236
+This value is not exported to the environment for child processes.
237
+
238
+#### `workspaces`
239
+
240
+* Default: false
241
+* Type: Boolean
242
+
243
+Enable running a command in the context of **all** the configured
244
+workspaces.
245
+
246
+This value is not exported to the environment for child processes.
247
+
248
+<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
249
+## See Also
250
+
251
+* [npm install](/cli/v7/commands/npm-install)
252
+* [npm init](/cli/v7/commands/npm-init)
253
+* [npm config](/cli/v7/commands/npm-config)
254
+* [npm set-script](/cli/v7/commands/npm-set-script)
255
+* [workspaces](/cli/v7/using-npm/workspaces)
content/cli/v7/commands/npm-profile.md
+3
@@ -101,6 +101,9 @@ The base URL of the npm registry.
101
102
Whether or not to output JSON data, rather than the normal output.
103
104
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
105
+ saving them to your `package.json`.
106
+
107
Not supported by all npm commands.
108
109
#### `parseable`
content/cli/v7/commands/npm-prune.md
+3
@@ -85,6 +85,9 @@ Note: This is NOT honored by other network related commands, eg `dist-tags`,
85
86
Whether or not to output JSON data, rather than the normal output.
87
88
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
89
+ saving them to your `package.json`.
90
+
91
Not supported by all npm commands.
92
93
#### `workspace`
content/cli/v7/commands/npm-search.md
+3
@@ -65,6 +65,9 @@ Show extended information in `ls`, `search`, and `help-search`.
65
66
Whether or not to output JSON data, rather than the normal output.
67
68
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
69
+ saving them to your `package.json`.
70
+
71
Not supported by all npm commands.
72
73
#### `color`
content/cli/v7/commands/npm-team.md
+3
@@ -148,6 +148,9 @@ Output parseable results from commands that write to standard output. For
148
149
Whether or not to output JSON data, rather than the normal output.
150
151
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
152
+ saving them to your `package.json`.
153
+
154
Not supported by all npm commands.
155
156
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
content/cli/v7/commands/npm-unpublish.md
+1
@@ -92,6 +92,7 @@ mistakes, unnecessary performance degradation, and malicious input.
92
* Allow unpublishing all versions of a published package.
93
* Allow conflicting peerDependencies to be installed in the root project.
94
* Implicitly set `--yes` during `npm init`.
95
+* Allow clobbering existing values in `npm pkg`
96
97
If you don't have a clear idea of what you want to do, it is strongly
98
recommended that you do not use this option!
content/cli/v7/commands/npm-update.md
+40
-4
@@ -25,7 +25,9 @@ aliases: up, upgrade
25
### Description
26
27
This command will update all the packages listed to the latest version
28
-(specified by the `tag` config), respecting semver.
28
+(specified by the `tag` config), respecting the semver constraints of
29
+both your package and its dependencies (if they also require the same
30
+package).
31
32
It will also install missing packages.
33
@@ -111,6 +113,39 @@ Then `npm update` will install `dep1@0.4.1`, because that is the highest-sorting
113
version that satisfies `^0.4.0` (`>= 0.4.0 <0.5.0`)
114
115
116
+#### Subdependencies
117
+
118
+Suppose your app now also has a dependency on `dep2`
119
+
120
+```json
121
+{
122
+ "name": "my-app",
123
+ "dependencies": {
124
+ "dep1": "^1.0.0",
125
+ "dep2": "1.0.0"
126
+ }
127
+}
128
+```
129
+
130
+and `dep2` itself depends on this limited range of `dep1`
131
+
132
+```json
133
+{
134
+"name": "dep2",
135
+ "dependencies": {
136
+ "dep1": "~1.1.1"
137
+ }
138
+}
139
+```
140
+
141
+Then `npm update` will install `dep1@1.1.2` because that is the highest
142
+version that `dep2` allows. npm will prioritize having a single version
143
+of `dep1` in your tree rather than two when that single version can
144
+satisfy the semver requirements of multiple dependencies in your tree.
145
+In this case if you really did need your package to use a newer version
146
+you would need to use `npm install`.
147
+
148
+
149
#### Updating Globally-Installed Packages
150
151
`npm update -g` will apply the `update` action to each globally installed
@@ -230,9 +265,10 @@ will *not* run any pre- or post-scripts.
265
* Default: true
266
* Type: Boolean
267
233
-When "true" submit audit reports alongside `npm install` runs to the default
234
-registry and all registries configured for scopes. See the documentation for
235
-[`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.
268
+When "true" submit audit reports alongside the current npm command to the
269
+default registry and all registries configured for scopes. See the
270
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
271
+submitted.
272
273
#### `bin-links`
274
content/cli/v7/commands/npm-version.md
+3
@@ -57,6 +57,9 @@ Tag the commit when using the `npm version` command.
57
58
Whether or not to output JSON data, rather than the normal output.
59
60
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
61
+ saving them to your `package.json`.
62
+
63
Not supported by all npm commands.
64
65
#### `preid`
content/cli/v7/commands/npm-view.md
+4
-1
@@ -59,7 +59,7 @@ npm view opts@$(npm view ronn dependencies.opts)
59
60
For fields that are arrays, requesting a non-numeric field will return
61
all of the values from the objects in the list. For example, to get all
62
-the contributor names for the `express` package, you would run:
62
+the contributor email addresses for the `express` package, you would run:
63
64
```bash
65
npm view express contributors.email
@@ -115,6 +115,9 @@ npm view connect versions
115
116
Whether or not to output JSON data, rather than the normal output.
117
118
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
119
+ saving them to your `package.json`.
120
+
121
Not supported by all npm commands.
122
123
#### `workspace`
content/cli/v7/configuring-npm/folders.md
+4
-2
@@ -53,14 +53,16 @@ Global installs on Windows go to `{prefix}/node_modules` (that is, no
53
Scoped packages are installed the same way, except they are grouped together
54
in a sub-folder of the relevant `node_modules` folder with the name of that
55
scope prefix by the @ symbol, e.g. `npm install @myorg/package` would place
56
-the package in `{prefix}/node_modules/@myorg/package`. See [`scope`](/cli/v7/using-npm/scope) for more details.
56
+the package in `{prefix}/node_modules/@myorg/package`. See
57
+[`scope`](/cli/v7/using-npm/scope) for more details.
58
59
If you wish to `require()` a package, then install it locally.
60
61
#### Executables
62
63
When in global mode, executables are linked into `{prefix}/bin` on Unix,
63
-or directly into `{prefix}` on Windows.
64
+or directly into `{prefix}` on Windows. Ensure that path is in your
65
+terminal's `PATH` environment to run them.
66
67
When in local mode, executables are linked into
68
`./node_modules/.bin` so that they can be made available to scripts run
content/cli/v7/configuring-npm/package-json.md
+9
-3
@@ -351,9 +351,12 @@ install into the PATH. npm makes this pretty easy (in fact, it uses this
351
feature to install the "npm" executable.)
352
353
To use this, supply a `bin` field in your package.json which is a map of
354
-command name to local file name. On install, npm will symlink that file
355
-into `prefix/bin` for global installs, or `./node_modules/.bin/` for local
356
-installs.
354
+command name to local file name. When this package is installed
355
+globally, that file will be linked where global bins go so it is
356
+available to run by name. When this package is installed as a
357
+dependency in another package, the file will be linked where it will be
358
+available to that package either directly by `npm exec` or by name in other
359
+scripts when invoking them via `npm run-script`.
360
361
362
For example, myapp could have this:
@@ -398,6 +401,9 @@ executable!
401
402
Note that you can also set the executable files using [directories.bin](#directoriesbin).
403
404
+See [folders](/cli/v7/configuring-npm/folders#executables) for more info on
405
+executables.
406
+
407
### man
408
409
Specify either a single file or an array of filenames to put in place for
content/cli/v7/using-npm/config.md
+17
-3
@@ -75,6 +75,7 @@ The following shorthands are parsed on the command-line:
75
* `--desc`: `--description`
76
* `-f`: `--force`
77
* `-g`: `--global`
78
+* `-L`: `--location`
79
* `-d`: `--loglevel info`
80
* `-s`: `--loglevel silent`
81
* `--silent`: `--loglevel silent`
@@ -178,9 +179,10 @@ to the same value as the current version.
179
* Default: true
180
* Type: Boolean
181
181
-When "true" submit audit reports alongside `npm install` runs to the default
182
-registry and all registries configured for scopes. See the documentation for
183
-[`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.
182
+When "true" submit audit reports alongside the current npm command to the
183
+default registry and all registries configured for scopes. See the
184
+documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is
185
+submitted.
186
187
#### `audit-level`
188
@@ -503,6 +505,7 @@ mistakes, unnecessary performance degradation, and malicious input.
505
* Allow unpublishing all versions of a published package.
506
* Allow conflicting peerDependencies to be installed in the root project.
507
* Implicitly set `--yes` during `npm init`.
508
+* Allow clobbering existing values in `npm pkg`
509
510
If you don't have a clear idea of what you want to do, it is strongly
511
recommended that you do not use this option!
@@ -702,6 +705,9 @@ number, if not already set in package.json.
705
706
Whether or not to output JSON data, rather than the normal output.
707
708
+* In `npm pkg set` it enables parsing set values with JSON.parse() before
709
+ saving them to your `package.json`.
710
+
711
Not supported by all npm commands.
712
713
#### `key`
@@ -761,6 +767,14 @@ Used with `npm ls`, limiting output to only those packages that are linked.
767
The IP address of the local interface to use when making connections to the
768
npm registry. Must be IPv4 in versions of Node prior to 0.12.
769
770
+#### `location`
771
+
772
+* Default: "user" unless `--global` is passed, which will also set this value
773
+ to "global"
774
+* Type: "global", "user", or "project"
775
+
776
+When passed to `npm config` this refers to which config file to use.
777
+
778
#### `loglevel`
779
780
* Default: "notice"
content/cli/v7/using-npm/scripts.md
+4
-3
@@ -62,7 +62,8 @@ situations. These scripts happen in addition to the `pre<event>`, `post<event>`,
62
the prepare script will be run, before the package is packaged and
63
installed.
64
65
-* As of `npm@7` these scripts run in the background
65
+* As of `npm@7` these scripts run in the background.
66
+ To see the output, run with: `--foreground-scripts`.
67
68
**prepublish** (DEPRECATED)
69
* Does not run during `npm publish`, but does run during `npm ci`
@@ -311,8 +312,8 @@ Scripts are run by passing the line as a script argument to `sh`.
312
If the script exits with a code other than 0, then this will abort the
313
process.
314
314
-Note that these script files don't have to be nodejs or even
315
-javascript programs. They just have to be some kind of executable
315
+Note that these script files don't have to be Node.js or even
316
+JavaScript programs. They just have to be some kind of executable
317
file.
318
319
### Best Practices
content/cli/v7/using-npm/workspaces.md
+1
-1
@@ -45,7 +45,7 @@ Workspaces are usually defined via the `workspaces` property of the
45
46
Given the above `package.json` example living at a current working
47
directory `.` that contains a folder named `workspace-a` that itself contains
48
-a `package.json` inside it, defining a nodejs package, e.g:
48
+a `package.json` inside it, defining a Node.js package, e.g:
49
50
```
51
.
src/gatsby-theme-doctornpm/nav.yml
+3
@@ -660,6 +660,9 @@
660
- title: npm ping
661
url: /cli/v7/commands/npm-ping
662
description: Ping npm registry
663
+ - title: npm pkg
664
+ url: /cli/v7/commands/npm-pkg
665
+ description: Manages your package.json
666
- title: npm prefix
667
url: /cli/v7/commands/npm-prefix
668
description: Display prefix