Skip to content

fix: warnings for Node.js version should be shown once #4756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2019

Conversation

rosen-vladimirov
Copy link
Contributor

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.

PR Checklist

What is the current behavior?

CLI prints warnings for Node.js version twice per command in cases when used Node.js version is not supported or deprecated.

What is the new behavior?

CLI prints warnings for Node.js version only once per command in cases when used Node.js version is not supported or deprecated.

Related to #4649

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.
@rosen-vladimirov rosen-vladimirov added this to the 6.0.0 milestone Jun 24, 2019
@rosen-vladimirov rosen-vladimirov self-assigned this Jun 24, 2019
@cla-bot cla-bot bot added the cla: yes label Jun 24, 2019
@rosen-vladimirov rosen-vladimirov merged commit e1ac117 into master Jun 24, 2019
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/node-warns branch June 24, 2019 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants