| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -374,7 +374,8 @@ the order in which omit/include are specified on the command-line. | |||
| 374 | 374 | ||
| 375 | 375 | #### `foreground-scripts` | |
| 376 | 376 | ||
| 377 | - * Default: false | ||
| 377 | + * Default: `false` unless when using `npm pack` or `npm publish` where it | ||
| 378 | + defaults to `true` | ||
| 378 | 379 | * Type: Boolean | |
| 379 | 380 | ||
| 380 | 381 | Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,7 +169,8 @@ this warning is treated as a failure. | |||
| 169 | 169 | ||
| 170 | 170 | #### `foreground-scripts` | |
| 171 | 171 | ||
| 172 | - * Default: false | ||
| 172 | + * Default: `false` unless when using `npm pack` or `npm publish` where it | ||
| 173 | + defaults to `true` | ||
| 173 | 174 | * Type: Boolean | |
| 174 | 175 | ||
| 175 | 176 | Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,7 +44,8 @@ npm config set key=value [key=value...] | |||
| 44 | 44 | npm set key=value [key=value...] | |
| 45 | 45 | ``` | |
| 46 | 46 | ||
| 47 | - Sets each of the config keys to the value provided. | ||
| 47 | + Sets each of the config keys to the value provided. Modifies the user configuration | ||
| 48 | + file unless [`location`](/commands/npm-config#location) is passed. | ||
| 48 | 49 | ||
| 49 | 50 | If value is omitted, the key will be removed from your config file entirely. | |
| 50 | 51 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -115,7 +115,8 @@ this warning is treated as a failure. | |||
| 115 | 115 | ||
| 116 | 116 | #### `foreground-scripts` | |
| 117 | 117 | ||
| 118 | - * Default: false | ||
| 118 | + * Default: `false` unless when using `npm pack` or `npm publish` where it | ||
| 119 | + defaults to `true` | ||
| 119 | 120 | * Type: Boolean | |
| 120 | 121 | ||
| 121 | 122 | Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -192,7 +192,8 @@ For `list` this means the output will be based on the tree described by the | |||
| 192 | 192 | ||
| 193 | 193 | #### `foreground-scripts` | |
| 194 | 194 | ||
| 195 | - * Default: false | ||
| 195 | + * Default: `false` unless when using `npm pack` or `npm publish` where it | ||
| 196 | + defaults to `true` | ||
| 196 | 197 | * Type: Boolean | |
| 197 | 198 | ||
| 198 | 199 | Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -582,7 +582,8 @@ For `list` this means the output will be based on the tree described by the | |||
| 582 | 582 | ||
| 583 | 583 | #### `foreground-scripts` | |
| 584 | 584 | ||
| 585 | - * Default: false | ||
| 585 | + * Default: `false` unless when using `npm pack` or `npm publish` where it | ||
| 586 | + defaults to `true` | ||
| 586 | 587 | * Type: Boolean | |
| 587 | 588 | ||
| 588 | 589 | Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For | |||
| 27 | 27 | example, running `npm ls promzard` in npm's source tree will show: | |
| 28 | 28 | ||
| 29 | 29 | ```bash | |
| 30 | - npm@10.3.0 /path/to/npm | ||
| 30 | + npm@10.5.0 /path/to/npm | ||
| 31 | 31 | └─┬ init-package-json@0.0.4 | |
| 32 | 32 | └── promzard@0.1.5 | |
| 33 | 33 | ``` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,7 +99,8 @@ Not supported by all npm commands. | |||
| 99 | 99 | ||
| 100 | 100 | #### `foreground-scripts` | |
| 101 | 101 | ||
| 102 | - * Default: false | ||
| 102 | + * Default: `false` unless when using `npm pack` or `npm publish` where it | ||
| 103 | + defaults to `true` | ||
| 103 | 104 | * Type: Boolean | |
| 104 | 105 | ||
| 105 | 106 | Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,19 +135,32 @@ npm query ":type(git)" | jq 'map(.name)' | xargs -I {} npm why {} | |||
| 135 | 135 | }, | |
| 136 | 136 | ... | |
| 137 | 137 | ``` | |
| 138 | - ### Package lock only mode | ||
| 139 | 138 | ||
| 140 | - If package-lock-only is enabled, only the information in the package | ||
| 141 | - lock (or shrinkwrap) is loaded. This means that information from the | ||
| 142 | - package.json files of your dependencies will not be included in the | ||
| 143 | - result set (e.g. description, homepage, engines). | ||
| 139 | + ### Expecting a certain number of results | ||
| 140 | + | ||
| 141 | + One common use of `npm query` is to make sure there is only one version of | ||
| 142 | + a certain dependency in your tree. This is especially common for | ||
| 143 | + ecosystems like that rely on `typescript` where having state split | ||
| 144 | + across two different but identically-named packages causes bugs. You | ||
| 145 | + can use the `--expect-results` or `--expect-result-count` in your setup | ||
| 146 | + to ensure that npm will exit with an exit code if your tree doesn't look | ||
| 147 | + like you want it to. | ||
| 148 | + | ||
| 149 | + | ||
| 150 | + ```sh | ||
| 151 | + $ npm query '#react' --expect-result-count=1 | ||
| 152 | + ``` | ||
| 153 | + | ||
| 154 | + Perhaps you want to quickly check if there are any production | ||
| 155 | + dependencies that could be updated: | ||
| 156 | + | ||
| 157 | + ```sh | ||
| 158 | + $ npm query ':root>:outdated(in-range).prod' --no-expect-results | ||
| 159 | + ``` | ||
| 144 | 160 | ||
| 145 | 161 | ### Package lock only mode | |
| 146 | 162 | ||
| 147 | - If package-lock-only is enabled, only the information in the package | ||
| 148 | - lock (or shrinkwrap) is loaded. This means that information from the | ||
| 149 | - package.json files of your dependencies will not be included in the | ||
| 150 | - result set (e.g. description, homepage, engines). | ||
| 163 | + If package-lock-only is enabled, only the information in the package lock (or shrinkwrap) is loaded. This means that information from the package.json files of your dependencies will not be included in the result set (e.g. description, homepage, engines). | ||
| 151 | 164 | ||
| 152 | 165 | ### Configuration | |
| 153 | 166 | ||
@@ -235,6 +248,25 @@ For `list` this means the output will be based on the tree described by the | |||
| 235 | 248 | `package-lock.json`, rather than the contents of `node_modules`. | |
| 236 | 249 | ||
| 237 | 250 | ||
| 251 | + | ||
| 252 | + #### `expect-results` | ||
| 253 | + | ||
| 254 | + * Default: null | ||
| 255 | + * Type: null or Boolean | ||
| 256 | + | ||
| 257 | + Tells npm whether or not to expect results from the command. Can be either | ||
| 258 | + true (expect some results) or false (expect no results). | ||
| 259 | + | ||
| 260 | + This config can not be used with: `expect-result-count` | ||
| 261 | + | ||
| 262 | + #### `expect-result-count` | ||
| 263 | + | ||
| 264 | + * Default: null | ||
| 265 | + * Type: null or Number | ||
| 266 | + | ||
| 267 | + Tells to expect a specific number of results from the command. | ||
| 268 | + | ||
| 269 | + This config can not be used with: `expect-results` | ||
| 238 | 270 | ## See Also | |
| 239 | 271 | ||
| 240 | 272 | * [dependency selectors](/using-npm/dependency-selectors) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,7 +72,8 @@ systems. | |||
| 72 | 72 | ||
| 73 | 73 | #### `foreground-scripts` | |
| 74 | 74 | ||
| 75 | - * Default: false | ||
| 75 | + * Default: `false` unless when using `npm pack` or `npm publish` where it | ||
| 76 | + defaults to `true` | ||
| 76 | 77 | * Type: Boolean | |
| 77 | 78 | ||
| 78 | 79 | Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments