fix: warnings for Node.js version should be shown once #4756
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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).nativescript-cli
file - we callinitializeService.initialize
, which also checks Node.js version and prints the warningsHowever, 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