check-node-version
Advanced tools
Comparing version 3.1.1 to 3.2.0
## Releases | ||
### 3.2.0 | ||
* Add `index.ts` TypeScript typings file | ||
### 3.1.1 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "check-node-version", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "Check installed versions of node and npm", | ||
@@ -22,2 +22,3 @@ "main": "index.js", | ||
"license": "WTFPL", | ||
"types": "./index.d.ts", | ||
"bugs": { | ||
@@ -24,0 +25,0 @@ "url": "https://github.com/parshap/check-node-version/issues" |
@@ -130,3 +130,32 @@ # check-node-version | ||
This module can also be used programmatically from node. See `index.js` | ||
and `test.js` for more information. | ||
This module can also be used programmatically. | ||
Pass it an object with the required versions of `node`, `npm`, and/or `yarn` followed by a results handler. | ||
```javascript | ||
const check = require("check-node-version"); | ||
check( | ||
{ node: ">= 18.3", }, | ||
(error, results) => { | ||
if (error) { | ||
console.error(error); | ||
return; | ||
} | ||
if (results.isSatisfied) { | ||
console.log("All is well."); | ||
return; | ||
} | ||
console.error("Some package version(s) failed!"); | ||
for (const packageName of Object.keys(results.versions)) { | ||
if (!results.versions[packageName].isSatisfied) { | ||
console.error(`Missing ${packageName}.`); | ||
} | ||
} | ||
} | ||
); | ||
``` | ||
See `index.d.ts` for the full input and output type definitions. |
Sorry, the diff of this file is not supported yet
18846
10
480
161