You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`
Copy file name to clipboardexpand all lines: deps/npm/docs/content/using-npm/dependency-selectors.md
+21-5
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ The [`npm query`](/commands/npm-query) command exposes a new dependency selector
13
13
- Unlocks the ability to answer complex, multi-faceted questions about dependencies, their relationships & associative metadata
14
14
- Consolidates redundant logic of similar query commands in `npm` (ex. `npm fund`, `npm ls`, `npm outdated`, `npm audit` ...)
15
15
16
-
### Dependency Selector Syntax`v1.0.0`
16
+
### Dependency Selector Syntax
17
17
18
18
#### Overview:
19
19
@@ -62,6 +62,7 @@ The [`npm query`](/commands/npm-query) command exposes a new dependency selector
62
62
-`:path(<path>)`[glob](https://www.npmjs.com/package/glob) matching based on dependencies path relative to the project
63
63
-`:type(<type>)`[based on currently recognized types](https://github.com/npm/npm-package-arg#result-object)
64
64
-`:outdated(<type>)` when a dependency is outdated
65
+
-`:vuln(<selector>)` when a dependency has a known vulnerability
65
66
66
67
##### `:semver(<spec>, [selector], [function])`
67
68
@@ -84,8 +85,8 @@ Some examples:
84
85
The `:outdated` pseudo selector retrieves data from the registry and returns information about which of your dependencies are outdated. The type parameter may be one of the following:
85
86
86
87
-`any` (default) a version exists that is greater than the current one
87
-
-`in-range` a version exists that is greater than the current one, and satisfies at least one if its dependents
88
-
-`out-of-range` a version exists that is greater than the current one, does not satisfy at least one of its dependents
88
+
-`in-range` a version exists that is greater than the current one, and satisfies at least one if its parent's dependencies
89
+
-`out-of-range` a version exists that is greater than the current one, does not satisfy at least one of its parent's dependencies
89
90
-`major` a version exists that is a semver major greater than the current one
90
91
-`minor` a version exists that is a semver minor greater than the current one
91
92
-`patch` a version exists that is a semver patch greater than the current one
@@ -99,14 +100,29 @@ In addition to the filtering performed by the pseudo selector, some extra data i
99
100
Some examples:
100
101
101
102
-`:root > :outdated(major)` returns every direct dependency that has a new semver major release
102
-
-`.prod:outdated(in-range)` returns production dependencies that have a new release that satisfies at least one of its edges in
103
+
-`.prod:outdated(in-range)` returns production dependencies that have a new release that satisfies at least one of its parent's dependencies
104
+
105
+
##### `:vuln`
106
+
107
+
The `:vuln` pseudo selector retrieves data from the registry and returns information about which if your dependencies has a known vulnerability. Only dependencies whose current version matches a vulnerability will be returned. For example if you have `semver@7.6.0` in your tree, a vulnerability for `semver` which affects versions `<=6.3.1` will not match.
108
+
109
+
You can also filter results by certain attributes in advisories. Currently that includes `severity` and `cwe`. Note that severity filtering is done per severity, it does not include severities "higher" or "lower" than the one specified.
110
+
111
+
In addition to the filtering performed by the pseudo selector, info about each relevant advisory will be added to the `queryContext` attribute of each node under the `advisories` attribute.
112
+
113
+
Some examples:
114
+
115
+
-`:root > .prod:vuln` returns direct production dependencies with any known vulnerability
116
+
-`:vuln([severity=high])` returns only dependencies with a vulnerability with a `high` severity.
117
+
-`:vuln([severity=high],[severity=moderate])` returns only dependencies with a vulnerability with a `high` or `moderate` severity.
118
+
-`:vuln([cwe=1333])` returns only dependencies with a vulnerability that includes CWE-1333 (ReDoS)
Copy file name to clipboardexpand all lines: deps/npm/docs/content/using-npm/workspaces.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ description: Working with workspaces
7
7
### Description
8
8
9
9
**Workspaces** is a generic term that refers to the set of features in the
10
-
npm cli that provides support to managing multiple packages from your local
10
+
npm cli that provides support for managing multiple packages from your local
11
11
file system from within a singular top-level, root package.
12
12
13
13
This set of features makes up for a much more streamlined workflow handling
14
-
linked packages from the local file system. Automating the linking process
15
-
as part of `npm install` and avoiding manually having to use `npm link` in
14
+
linked packages from the local file system. It automates the linking process
15
+
as part of `npm install` and removes the need to manually use `npm link` in
16
16
order to add references to packages that should be symlinked into the current
17
17
`node_modules` folder.
18
18
@@ -110,7 +110,7 @@ respect the provided `workspace` configuration.
110
110
111
111
### Using workspaces
112
112
113
-
Given the [specifities of how Node.js handles module resolution](https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together) it's possible to consume any defined workspace
113
+
Given the [specifics of how Node.js handles module resolution](https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together) it's possible to consume any defined workspace
114
114
by its declared `package.json``name`. Continuing from the example defined
115
115
above, let's also create a Node.js script that will require the workspace `a`
0 commit comments