You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/07/23 04:29:42 UTC

[cordova-cli] branch master updated: chore: node warning on version < 8 (#454)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c8ca07  chore: node warning on version < 8 (#454)
1c8ca07 is described below

commit 1c8ca07f04b2f2a8b0477a0440904584fb01b76f
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Tue Jul 23 13:29:36 2019 +0900

    chore: node warning on version < 8 (#454)
---
 package.json |  1 +
 src/cli.js   | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/package.json b/package.json
index 044c195..2929197 100644
--- a/package.json
+++ b/package.json
@@ -36,6 +36,7 @@
     "insight": "^0.10.1",
     "loud-rejection": "^2.0.0",
     "nopt": "^4.0.1",
+    "semver": "^6.2.0",
     "update-notifier": "^2.5.0"
   },
   "devDependencies": {
diff --git a/src/cli.js b/src/cli.js
index 0d5089d..02aa7c6 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -29,6 +29,9 @@ var logger = require('cordova-common').CordovaLogger.get();
 var Configstore = require('configstore');
 var conf = new Configstore(pkg.name + '-config');
 var editor = require('editor');
+const semver = require('semver');
+
+const NODE_VERSION_REQUIREMENT = '>=8';
 
 var knownOpts = {
     'verbose': Boolean,
@@ -296,10 +299,9 @@ function cli (inputArgs) {
         }
     }
 
-    if (/^v0.\d+[.\d+]*/.exec(process.version)) { // matches v0.*
-        var msg1 = 'Warning: using node version ' + process.version +
-                ' which has been deprecated. Please upgrade to the latest Node.js version available (LTS version recommended).';
-        logger.warn(msg1);
+    // If the Node.js versions does not meet our requirements, it will then display warning.
+    if (!semver.satisfies(process.version, NODE_VERSION_REQUIREMENT)) {
+        logger.warn(`Warning: Node.js ${process.version} is no longer supported. Please upgrade to the latest Node.js version available (LTS version recommended).`);
     }
 
     // If there were arguments protected from nopt with a double dash, keep


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org