Node version check

This commit is contained in:
Will Boyd
2021-01-24 12:39:43 -05:00
parent acd2c21230
commit 51e8211e1f
3 changed files with 24 additions and 10 deletions
+8
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env node
const compareVersions = require('compare-versions');
const path = require('path');
const process = require('process');
@@ -8,6 +9,13 @@ const parser = require('./src/parser');
const writer = require('./src/writer');
(async () => {
// Node version check
const requiredVersion = '12.14.0';
const currentVersion = process.versions.node;
if (compareVersions(currentVersion, requiredVersion) === -1) {
throw `This script requires Node v${requiredVersion} or higher, but you are using v${currentVersion}.`;
}
// parse any command line arguments and run wizard
const config = await wizard.getConfig(process.argv);