tools: Fix node version check in check-development-environment.sh #23760
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.
Changes proposed in this Pull Request:
The minimum version set in package.json is like
^14.18.3 || ^16.13.2
.We weren't handling that correctly, we were comparing with a minimum
"version" of "14.18.3 || ^16.13.2" rather than anything well-formed.
This changes the check to extract the constraint matching the current
major version of node (i.e. "14.18.3" or "16.13.2"), falling back to the
recommended major if someone has a completely unsupported major version
(e.g. 15 or 17) installed, to use as the minimum version in the check.
This still produces slightly misleading results in that if someone is on
node 12 or 15 it won't tell them that 14 is an option, but that's
probably ok since we only have 14 in there because Gutenberg Mobile is
still on that version for their build (cf. #20990).
Jetpack product discussion
p1648828186794899-slack-CBG1CP4EN
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Test with the following node versions for the specified results. Note that, to avoid having to actually install the different versions, you can just add a line near line 314 to set
VER
appropriately.