| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 594d943 commit d66a807
191 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,7 +67,7 @@ $ npm ci | |||
| 67 | 67 | added 154 packages in 5s | |
| 68 | 68 | ``` | |
| 69 | 69 | ||
| 70 | - Configure Travis to build using `npm ci` instead of `npm install`: | ||
| 70 | + Configure Travis CI to build using `npm ci` instead of `npm install`: | ||
| 71 | 71 | ||
| 72 | 72 | ```bash | |
| 73 | 73 | # .travis.yml | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -127,7 +127,7 @@ $ npm exec -- foo@latest bar --package=@npmcli/foo | |||
| 127 | 127 | * Default: | |
| 128 | 128 | * Type: String (can be set multiple times) | |
| 129 | 129 | ||
| 130 | - The package to install for [`npm exec`](/commands/npm-exec) | ||
| 130 | + The package or packages to install for [`npm exec`](/commands/npm-exec) | ||
| 131 | 131 | ||
| 132 | 132 | <!-- automatically generated, do not edit manually --> | |
| 133 | 133 | <!-- see lib/utils/config/definitions.js --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,235 @@ | |||
| 1 | + --- | ||
| 2 | + title: npm-query | ||
| 3 | + section: 1 | ||
| 4 | + description: Dependency selector query | ||
| 5 | + --- | ||
| 6 | + | ||
| 7 | + ### Synopsis | ||
| 8 | + | ||
| 9 | + <!-- AUTOGENERATED USAGE DESCRIPTIONS START --> | ||
| 10 | + <!-- automatically generated, do not edit manually --> | ||
| 11 | + <!-- see lib/commands/query.js --> | ||
| 12 | + | ||
| 13 | + ```bash | ||
| 14 | + npm query <selector> | ||
| 15 | + ``` | ||
| 16 | + | ||
| 17 | + <!-- automatically generated, do not edit manually --> | ||
| 18 | + <!-- see lib/commands/query.js --> | ||
| 19 | + | ||
| 20 | + <!-- AUTOGENERATED USAGE DESCRIPTIONS END --> | ||
| 21 | + | ||
| 22 | + ### Description | ||
| 23 | + | ||
| 24 | + The `npm query` command allows for usage of css selectors in order to retrieve | ||
| 25 | + an array of dependency objects. | ||
| 26 | + | ||
| 27 | + ### Piping npm query to other commands | ||
| 28 | + | ||
| 29 | + ```bash | ||
| 30 | + # find all dependencies with postinstall scripts & uninstall them | ||
| 31 | + npm query ":attr(scripts, [postinstall])" | jq 'map(.name)|join("\n")' -r | xargs -I {} npm uninstall {} | ||
| 32 | + | ||
| 33 | + # find all git dependencies & explain who requires them | ||
| 34 | + npm query ":type(git)" | jq 'map(.name)' | xargs -I {} npm why {} | ||
| 35 | + ``` | ||
| 36 | + | ||
| 37 | + ### Extended Use Cases & Queries | ||
| 38 | + | ||
| 39 | + ```stylus | ||
| 40 | + // all deps | ||
| 41 | + * | ||
| 42 | + | ||
| 43 | + // all direct deps | ||
| 44 | + :root > * | ||
| 45 | + | ||
| 46 | + // direct production deps | ||
| 47 | + :root > .prod | ||
| 48 | + | ||
| 49 | + // direct development deps | ||
| 50 | + :root > .dev | ||
| 51 | + | ||
| 52 | + // any peer dep of a direct deps | ||
| 53 | + :root > * > .peer | ||
| 54 | + | ||
| 55 | + // any workspace dep | ||
| 56 | + .workspace | ||
| 57 | + | ||
| 58 | + // all workspaces that depend on another workspace | ||
| 59 | + .workspace > .workspace | ||
| 60 | + | ||
| 61 | + // all workspaces that have peer deps | ||
| 62 | + .workspace:has(.peer) | ||
| 63 | + | ||
| 64 | + // any dep named "lodash" | ||
| 65 | + // equivalent to [name="lodash"] | ||
| 66 | + #lodash | ||
| 67 | + | ||
| 68 | + // any deps named "lodash" & within semver range ^"1.2.3" | ||
| 69 | + #lodash@^1.2.3 | ||
| 70 | + // equivalent to... | ||
| 71 | + [name="lodash"]:semver(^1.2.3) | ||
| 72 | + | ||
| 73 | + // get the hoisted node for a given semver range | ||
| 74 | + #lodash@^1.2.3:not(:deduped) | ||
| 75 | + | ||
| 76 | + // querying deps with a specific version | ||
| 77 | + #lodash@2.1.5 | ||
| 78 | + // equivalent to... | ||
| 79 | + [name="lodash"][version="2.1.5"] | ||
| 80 | + | ||
| 81 | + // has any deps | ||
| 82 | + :has(*) | ||
| 83 | + | ||
| 84 | + // deps with no other deps (ie. "leaf" nodes) | ||
| 85 | + :empty | ||
| 86 | + | ||
| 87 | + // manually querying git dependencies | ||
| 88 | + [repository^=github:], | ||
| 89 | + [repository^=git:], | ||
| 90 | + [repository^=https://github.com], | ||
| 91 | + [repository^=http://github.com], | ||
| 92 | + [repository^=https://github.com], | ||
| 93 | + [repository^=+git:...] | ||
| 94 | + | ||
| 95 | + // querying for all git dependencies | ||
| 96 | + :type(git) | ||
| 97 | + | ||
| 98 | + // get production dependencies that aren't also dev deps | ||
| 99 | + .prod:not(.dev) | ||
| 100 | + | ||
| 101 | + // get dependencies with specific licenses | ||
| 102 | + [license=MIT], [license=ISC] | ||
| 103 | + | ||
| 104 | + // find all packages that have @ruyadorno as a contributor | ||
| 105 | + :attr(contributors, [email=ruyadorno@github.com]) | ||
| 106 | + ``` | ||
| 107 | + | ||
| 108 | + ### Example Response Output | ||
| 109 | + | ||
| 110 | + - an array of dependency objects is returned which can contain multiple copies of the same package which may or may not have been linked or deduped | ||
| 111 | + | ||
| 112 | + ```json | ||
| 113 | + [ | ||
| 114 | + { | ||
| 115 | + "name": "", | ||
| 116 | + "version": "", | ||
| 117 | + "description": "", | ||
| 118 | + "homepage": "", | ||
| 119 | + "bugs": {}, | ||
| 120 | + "author": {}, | ||
| 121 | + "license": {}, | ||
| 122 | + "funding": {}, | ||
| 123 | + "files": [], | ||
| 124 | + "main": "", | ||
| 125 | + "browser": "", | ||
| 126 | + "bin": {}, | ||
| 127 | + "man": [], | ||
| 128 | + "directories": {}, | ||
| 129 | + "repository": {}, | ||
| 130 | + "scripts": {}, | ||
| 131 | + "config": {}, | ||
| 132 | + "dependencies": {}, | ||
| 133 | + "devDependencies": {}, | ||
| 134 | + "optionalDependencies": {}, | ||
| 135 | + "bundledDependencies": {}, | ||
| 136 | + "peerDependencies": {}, | ||
| 137 | + "peerDependenciesMeta": {}, | ||
| 138 | + "engines": {}, | ||
| 139 | + "os": [], | ||
| 140 | + "cpu": [], | ||
| 141 | + "workspaces": {}, | ||
| 142 | + "keywords": [], | ||
| 143 | + ... | ||
| 144 | + }, | ||
| 145 | + ... | ||
| 146 | + ``` | ||
| 147 | + | ||
| 148 | + ### Configuration | ||
| 149 | + | ||
| 150 | + <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> | ||
| 151 | + <!-- automatically generated, do not edit manually --> | ||
| 152 | + <!-- see lib/utils/config/definitions.js --> | ||
| 153 | + #### `global` | ||
| 154 | + | ||
| 155 | + * Default: false | ||
| 156 | + * Type: Boolean | ||
| 157 | + | ||
| 158 | + Operates in "global" mode, so that packages are installed into the `prefix` | ||
| 159 | + folder instead of the current working directory. See | ||
| 160 | + [folders](/configuring-npm/folders) for more on the differences in behavior. | ||
| 161 | + | ||
| 162 | + * packages are installed into the `{prefix}/lib/node_modules` folder, instead | ||
| 163 | + of the current working directory. | ||
| 164 | + * bin files are linked to `{prefix}/bin` | ||
| 165 | + * man pages are linked to `{prefix}/share/man` | ||
| 166 | + | ||
| 167 | + <!-- automatically generated, do not edit manually --> | ||
| 168 | + <!-- see lib/utils/config/definitions.js --> | ||
| 169 | + | ||
| 170 | + #### `workspace` | ||
| 171 | + | ||
| 172 | + * Default: | ||
| 173 | + * Type: String (can be set multiple times) | ||
| 174 | + | ||
| 175 | + Enable running a command in the context of the configured workspaces of the | ||
| 176 | + current project while filtering by running only the workspaces defined by | ||
| 177 | + this configuration option. | ||
| 178 | + | ||
| 179 | + Valid values for the `workspace` config are either: | ||
| 180 | + | ||
| 181 | + * Workspace names | ||
| 182 | + * Path to a workspace directory | ||
| 183 | + * Path to a parent workspace directory (will result in selecting all | ||
| 184 | + workspaces within that folder) | ||
| 185 | + | ||
| 186 | + When set for the `npm init` command, this may be set to the folder of a | ||
| 187 | + workspace which does not yet exist, to create the folder and set it up as a | ||
| 188 | + brand new workspace within the project. | ||
| 189 | + | ||
| 190 | + This value is not exported to the environment for child processes. | ||
| 191 | + | ||
| 192 | + <!-- automatically generated, do not edit manually --> | ||
| 193 | + <!-- see lib/utils/config/definitions.js --> | ||
| 194 | + | ||
| 195 | + #### `workspaces` | ||
| 196 | + | ||
| 197 | + * Default: null | ||
| 198 | + * Type: null or Boolean | ||
| 199 | + | ||
| 200 | + Set to true to run the command in the context of **all** configured | ||
| 201 | + workspaces. | ||
| 202 | + | ||
| 203 | + Explicitly setting this to false will cause commands like `install` to | ||
| 204 | + ignore workspaces altogether. When not set explicitly: | ||
| 205 | + | ||
| 206 | + - Commands that operate on the `node_modules` tree (install, update, etc.) | ||
| 207 | + will link workspaces into the `node_modules` folder. - Commands that do | ||
| 208 | + other things (test, exec, publish, etc.) will operate on the root project, | ||
| 209 | + _unless_ one or more workspaces are specified in the `workspace` config. | ||
| 210 | + | ||
| 211 | + This value is not exported to the environment for child processes. | ||
| 212 | + | ||
| 213 | + <!-- automatically generated, do not edit manually --> | ||
| 214 | + <!-- see lib/utils/config/definitions.js --> | ||
| 215 | + | ||
| 216 | + #### `include-workspace-root` | ||
| 217 | + | ||
| 218 | + * Default: false | ||
| 219 | + * Type: Boolean | ||
| 220 | + | ||
| 221 | + Include the workspace root when workspaces are enabled for a command. | ||
| 222 | + | ||
| 223 | + When false, specifying individual workspaces via the `workspace` config, or | ||
| 224 | + all workspaces via the `workspaces` flag, will cause npm to operate only on | ||
| 225 | + the specified workspaces, and not on the root project. | ||
| 226 | + | ||
| 227 | + This value is not exported to the environment for child processes. | ||
| 228 | + | ||
| 229 | + <!-- automatically generated, do not edit manually --> | ||
| 230 | + <!-- see lib/utils/config/definitions.js --> | ||
| 231 | + | ||
| 232 | + <!-- AUTOGENERATED CONFIG DESCRIPTIONS END --> | ||
| 233 | + ## See Also | ||
| 234 | + | ||
| 235 | + * [dependency selector](/using-npm/dependency-selector) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1244,7 +1244,7 @@ Directory in which `npm pack` will save tarballs. | |||
| 1244 | 1244 | * Default: | |
| 1245 | 1245 | * Type: String (can be set multiple times) | |
| 1246 | 1246 | ||
| 1247 | - The package to install for [`npm exec`](/commands/npm-exec) | ||
| 1247 | + The package or packages to install for [`npm exec`](/commands/npm-exec) | ||
| 1248 | 1248 | ||
| 1249 | 1249 | <!-- automatically generated, do not edit manually --> | |
| 1250 | 1250 | <!-- see lib/utils/config/definitions.js --> | |
@@ -1393,6 +1393,24 @@ The base URL of the npm registry. | |||
| 1393 | 1393 | <!-- automatically generated, do not edit manually --> | |
| 1394 | 1394 | <!-- see lib/utils/config/definitions.js --> | |
| 1395 | 1395 | ||
| 1396 | + #### `replace-registry-host` | ||
| 1397 | + | ||
| 1398 | + * Default: "npmjs" | ||
| 1399 | + * Type: "npmjs", "never", "always", or String | ||
| 1400 | + | ||
| 1401 | + Defines behavior for replacing the registry host in a lockfile with the | ||
| 1402 | + configured registry. | ||
| 1403 | + | ||
| 1404 | + The default behavior is to replace package dist URLs from the default | ||
| 1405 | + registry (https://registry.npmjs.org) to the configured registry. If set to | ||
| 1406 | + "never", then use the registry value. If set to "always", then replace the | ||
| 1407 | + registry host with the configured host every time. | ||
| 1408 | + | ||
| 1409 | + You may also specify a bare hostname (e.g., "registry.npmjs.org"). | ||
| 1410 | + | ||
| 1411 | + <!-- automatically generated, do not edit manually --> | ||
| 1412 | + <!-- see lib/utils/config/definitions.js --> | ||
| 1413 | + | ||
| 1396 | 1414 | #### `save` | |
| 1397 | 1415 | ||
| 1398 | 1416 | * Default: `true` unless when using `npm update` where it defaults to `false` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments