Version Guard
Used to ensure modern CLI scripts fail silently on old node.js versions
![Types in JS](https://img.shields.io/badge/types_in_js-yes-brightgreen)
Usage
Add a top-level file to your project, eg. cli.js
, containing something like:
require('version-guard')('./path/to/file/to/run', 14, 18);
Syntax
versionGuard(filePath, minMajor, [minMinor])
- filePath - a path to the modern file that should be run
- minMajor - the lowest major Node.js version that should be allowed to run the file
- [minMinor] - the lowest minor version of
minMajor
that should be allowed to run the file
Returns no data. Throws when configured incorrectly. Logs when failing silently.
filePath
gets imported using the dynamic import()
, thus supporting both ESM and CJS modules.
This project itself is a CJS project as the entire point is to work on incredibly old node.js versions.
Used by