From 4f54443ccc86b4e9b2608e957027bc74cdcd6e63 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 24 Jun 2019 08:52:36 +0300 Subject: [PATCH] fix: warnings for Node.js version should be shown once Currently when you are using a deprecated Node.js version, CLI prints warnings twice. The problem is that there are two places in the code where we check Node.js version: - In `tns` executable file - the code in it is pure ES5 and the idea is to stop users which have very old Node.js versions, whcih do not support ES6 syntax (CLI is transpiled to ES6 syntax). - In `nativescript-cli` file - we call `initializeService.initialize`, which also checks Node.js version and prints the warnings However, we do not need the warnings in both places. Separate the logic, so in `tns` file we'll just check if we should stop the users, i.e. it will take care only of versions which are not supported. In `nativescript-cli` we'll continue calling initialize, which will take care of the warnings (in case there are such). This way the warning for not supported version will be printed only once. --- lib/common/verify-node-version.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/common/verify-node-version.ts b/lib/common/verify-node-version.ts index b13fad32e3..30d429e6d7 100644 --- a/lib/common/verify-node-version.ts +++ b/lib/common/verify-node-version.ts @@ -46,11 +46,6 @@ export function verifyNodeVersion(): void { os.EOL, nodeVer, cliName, supportedVersionsRange, os.EOL).red.bold); process.exit(1); } - - var nodeWarning = getNodeWarning(); - if (nodeWarning && nodeWarning.message) { - console.warn((os.EOL + nodeWarning.message + os.EOL).yellow.bold); - } } var nodeWarn: ISystemWarning = undefined;