Skip to content
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

tools: Fix node version check in check-development-environment.sh #23760

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

anomiex
Copy link
Contributor

@anomiex anomiex commented Apr 1, 2022

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.

  • 14.18.2: "too old" in red, and "Version 14.18.3 or later is required; 16.13.2 or later is recommended."
  • 14.18.3: "ok" in yellow, and "Version 16.13.2 or later is recommended."
  • 14.19.1: "ok" in yellow, and "Version 16.13.2 or later is recommended."
  • 16.13.1: "too old" in red, and "Version 16.13.2 or later is required."
  • 16.13.2: "ok" in green, no additional message.
  • 12.22.11: "too old" in red, and "Version 16.13.2 or later is required."
  • 15.14.0: "too old" in red, and "Version 16.13.2 or later is required."
  • 17.8.0: "ok" in yellow, and "We've only tested with Node 16."

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).
@anomiex anomiex added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Pri] Normal labels Apr 1, 2022
@anomiex anomiex self-assigned this Apr 1, 2022
@anomiex anomiex enabled auto-merge (squash) April 1, 2022 16:48
@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2022

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.

@kraftbj kraftbj self-requested a review April 1, 2022 17:17
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well for me. 🚢

@anomiex anomiex merged commit a511be4 into master Apr 4, 2022
@anomiex anomiex deleted the fix/check-dev-env-node-version-check branch April 4, 2022 14:28
@github-actions github-actions bot removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants