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
Copy file name to clipboardExpand all lines: README.md
+44-6Lines changed: 44 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,45 +5,59 @@ List the Node.js versions supported by the package/repository
5
5
## Usage (command line)
6
6
7
7
```
8
-
$ npx detect-node-support [path]
8
+
$ npx detect-node-support [options] <path>
9
9
```
10
10
11
11
Prints the supported Node.js versions for the package at the specified path. When the path is not a git repository - tries to read the git repository from `package.json` and tries to detect the versions listed in the repository as well.
12
12
13
13
When `path` is omitted, tries to detect the versions for `cwd`.
Prints supported Node.js versions for the package at the git URL.
26
26
27
+
### Options
28
+
29
+
*`--deps` - include the support information of all dependencies
30
+
27
31
## Usage (library)
28
32
29
33
```
30
-
const result = await require('detect-node-support').detect({ path });
34
+
const result = await require('detect-node-support').detect({ path }, options);
31
35
```
32
36
33
37
`path` should be a folder in the local file system. When the path is not a git repository - tries to read the git repository from `package.json` and tries to detect the versions listed in the repository as well.
34
38
35
39
```
36
-
const result = await require('detect-node-support').detect({ packageName });
40
+
const result = await require('detect-node-support').detect({ packageName }, options);
37
41
```
38
42
39
43
`packageName` is a string name for the package in the registry.
40
44
41
45
```
42
-
const result = await require('detect-node-support').detect({ repository });
46
+
const result = await require('detect-node-support').detect({ repository }, options);
43
47
```
44
48
45
49
`repository` is a URL for a git repository.
46
50
51
+
```
52
+
const result = await require('detect-node-support').detect(what, options);
53
+
```
54
+
55
+
`what` is a string containing either a package name, or a local path, or a reference to a git repository.
56
+
57
+
### Options
58
+
59
+
-`deps: false` - when `true`, include the support information of all dependencies.
60
+
47
61
### Result
48
62
49
63
- Throws if the `path` / `repository` does not have a `package.json`
@@ -88,6 +102,30 @@ const result = {
88
102
"lts/*":"12.14.0",
89
103
"invalid-specifier":false
90
104
}
105
+
},
106
+
107
+
// only present when explicitly requested
108
+
"dependencies": {
109
+
110
+
// will contain a support object for every unique dependency in the tree
111
+
// note that the `version` will be the _latest_ version available in the registry
112
+
// see below for the actual versions installed
113
+
"support": [
114
+
{
115
+
"name":"dependency-A"
116
+
/*... other fields ...*/
117
+
},
118
+
{
119
+
"name":"dependency-B"
120
+
/*... other fields ...*/
121
+
}
122
+
],
123
+
124
+
// will contain a list of unique versions for each dependency found in the dependency tree
0 commit comments