-
-
Notifications
You must be signed in to change notification settings - Fork 267
Convert constraints from Prolog to JavaScript #4546
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
Conversation
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/semver@6.3.1 |
The existing Yarn constraints have been difficult to maintain because they are written in Prolog. More recent versions of Yarn support JavaScript-based constraints, so this commit rewrites the existing constraints in JavaScript. Instead of `constraints.pro`, all constraints are now kept in `yarn.config.cjs`. This file can be used for other things in the future besides constraints. (And constraints can be used in the future to check more than just dependencies!) Note that we have had discussions in the past around the peer dependency constraints, and we know that they are not quite correct. This will be fixed in another PR.
49f4cf0 to
aa6fa92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to review yarn.config.cjs :) It is being hidden in the diff.
|
Looks good to me. However, there are two rules that are missing which it will be nice if we can add them. Additionally, it would be helpful to create a ticket to address the inconsistency with some rules. For instance, we check that |
|
We should add a summary of the rules we are checking at the top of the file, like this: |
|
@cryptodev-2s We could add a summary at the top, but I'm already summarizing each step, and then on top of that I have documentation for each function that explains how certain constraints work. So if we added a summary, that would be a third form of documentation that people would have to remember to update if they updated the constraints. I guess we can regenerate it easily using ChatGPT, but maybe there's another way we can do this? I am sensing that if we need this, the |
cryptodev-2s
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The existing Yarn constraints have been difficult to maintain because they are written in Prolog. More recent versions of Yarn support JavaScript-based constraints, so this commit rewrites the existing constraints in JavaScript. Instead of `constraints.pro`, all constraints are now kept in `yarn.config.cjs`. This file can be used for other things in the future besides constraints. (And constraints can be used in the future to check more than just dependencies!) Note that we have had discussions in the past around the peer dependency constraints, and we know that they are not quite correct. This will be fixed in another PR. --------- Co-authored-by: cryptodev-2s <109512101+cryptodev-2s@users.noreply.github.com>
## Explanation Migrated constrains. [This PR](MetaMask/core#4546) was used as a base with various customizations to align with our constraints. See comments for adjustments to the prolog constraints. ## References Fixes [#17](#17) --------- Co-authored-by: Dimitrios Marlagkoutsos <dimitrismarl@opg7h1k69.home> Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Explanation
The existing Yarn constraints have been difficult to maintain because they are written in Prolog. More recent versions of Yarn support JavaScript-based constraints, so this commit rewrites the existing constraints in JavaScript.
Instead of
constraints.pro, all constraints are now kept inyarn.config.cjs. This file can be used for other things in the future besides constraints. (And constraints can be used in the future to check more than just dependencies!)Note that we have had discussions in the past around the peer dependency constraints, and we know that they are not quite correct. This will be fixed in another PR.
References
Fixes #4384.
Changelog
(No consumer-facing changes.)
Checklist