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

fix: special version node check #6509

Merged
merged 4 commits into from May 7, 2023

Conversation

btea
Copy link
Contributor

@btea btea commented May 6, 2023

@btea btea requested a review from zkochan as a code owner May 6, 2023 14:22
@welcome
Copy link

welcome bot commented May 6, 2023

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@@ -6,7 +6,7 @@ export function getSystemNodeVersionNonCached () {
if (process['pkg'] != null) {
return execa.sync('node', ['--version']).stdout.toString()
}
return process.version
return process.version.replace(/-.*$/, '')
Copy link
Member

Choose a reason for hiding this comment

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

why is this change required? Is it because it currently fails when checking if the node.js version satisfies the range in the engines field? I think in that case this change should be done before passing the version to semver. This function may be used also to print the node.js version and in that case I think we should return the correct version. Also, the way you did it, doesn't cover line 7.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I installed version v21.0.0-nightly20230429c968361829 to test a function of node. When I run the project, its engine.node field value ^14.18.0 || >=16.0.0 check will fail. Running it with npm will work fine.

I think in that case this change should be done before passing the version to semver.

You mean maybe we should change here?

if (wantedEngine.node && !semver.satisfies(currentEngine.node, wantedEngine.node)) {

This function may be used also to print the node.js version and in that case I think we should return the correct version. Also, the way you did it, doesn't cover line 7.

I was negligent, I didn't think about these before. If we modify it in the above way, there is no need to change it here.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that looks like the right place for the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, let me modify it.

@zkochan zkochan merged commit 9d4d967 into pnpm:main May 7, 2023
7 of 8 checks passed
@welcome
Copy link

welcome bot commented May 7, 2023

Congrats on merging your first pull request! 🎉🎉🎉

@btea
Copy link
Contributor Author

btea commented May 7, 2023

@zkochan Thank you for your efficient and hard work! ❤️

@btea btea deleted the fix/special-engine-version-check branch May 7, 2023 09:35
zkochan added a commit that referenced this pull request May 7, 2023
---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants