diff options
Diffstat (limited to '')
-rw-r--r-- | scripts/verifyVersion.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/verifyVersion.js b/scripts/verifyVersion.js new file mode 100644 index 0000000..8ad2d19 --- /dev/null +++ b/scripts/verifyVersion.js @@ -0,0 +1,15 @@ +/* istanbul ignore file */ + +const [major, minor, patch] = process.versions.node.split('.').map(v => Number(v)) +const required = process.argv.pop().split('.').map(v => Number(v)) + +const badMajor = major < required[0] +const badMinor = major === required[0] && minor < required[1] +const badPatch = major === required[0] && minor === required[1] && patch < required[2] + +if (badMajor || badMinor || badPatch) { + console.log(`Required Node.js >=${required.join('.')}, got ${process.versions.node}`) + console.log('Skipping') +} else { + process.exit(1) +} |