minimum-node-version
Version:
Figures out the lowest version of Node.js that satisfies package.json engines.node
64 lines (39 loc) • 1.92 kB
Markdown
# minimum-node-version
[](https://travis-ci.org/hugojosefson/minimum-node-version)
[](https://npmjs.com/package/minimum-node-version)
[](https://tldrlegal.com/license/-isc-license)
[](http://semver.org/spec/v2.0.0.html)
[](https://standardjs.com)
## Introduction
Figures out the lowest version of Node.js that satisfies `engines.node` in `package.json`.
Can be quite useful for which `node` version to configure `babel-preset-env` for.
## Prerequisite
Node.js, at least `v8.0.0`, but not `v9`.
Recommended to install latest via [nvm](https://github.com/nvm-sh/nvm#readme):
```bash
nvm install stable
```
## Installation
```bash
npm install -g minimum-node-version
```
## CLI Usage
```bash
minimum-node-version
```
Will print the Node.js version.
## Programmatic access
You can also `import` or `require` the module, and use it programmatically.
```js
import minimumNodeVersion from 'minimum-node-version'
minimumNodeVersion().then(
version => console.log(version)
)
```
### API
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
##### Table of Contents
- [minimumNodeVersion](#minimumnodeversion)
#### minimumNodeVersion
Figures out the minimum Node.js version that satisfies the project's configuration.
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** A Promise of the lowest compatible Node.js version.