-
-
Notifications
You must be signed in to change notification settings - Fork 214
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 dependency-related constraints #5464
Conversation
cc436b1
to
8517743
Compare
This commit adjusts the constraints in `yarn.config.cjs`: - Remove `expectControllerDependenciesListedAsPeerDependencies`. As its name implies, this constraint ensured that dependencies which referred to controllers were always listed as peer dependencies. This is incorrect, because in some cases we may simply want to list them as "production" dependencies. - Correct `expectDependenciesNotInBothProdAndDev` (now `expectDependenciesNotInBothProdAndDevOrPeer`) to not only ensure that a dependency is not listed in both `dependencies` and `devDependencies` but also both `dependencies` and `peerDependencies` (only `devDependencies` + `peerDependencies` is allowed, as combinations go). - Add `expectPeerDependenciesAlsoListedAsDevDependencies` constraint to ensure that peer dependencies are also listed as dev dependencies. - Fix `expectUpToDateWorkspaceDependenciesAndDevDependencies` to skip validation of "production" dependencies that are also listed in peer dependencies (this avoids conflicting constraints). - Correct `expectConsistentDependenciesAndDevDependencies` to skip workspace dependencies, as that is already being handled by `expectUpToDateWorkspaceDependenciesAndDevDependencies` (this avoids conflicting constraints). Note that because of these changes, several controllers have also been corrected to fit.
8517743
to
625caf9
Compare
* Expect that the workspace has the given field, and that it is a non-null | ||
* value. If the field is not present, or is null, this will log an error, and | ||
* cause the constraint to fail. | ||
* This function does one of three things depending on the arguments given: |
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.
Not related to this PR, but it had been a while since I'd worked on this file, and this description was confusing.
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!
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 for accounts-related files 👍
Looks good for Swaps/Bridge |
829152f
Explanation
I've noticed recently that it is impossible to add a controller dependency just to
dependencies
; one of our existing constraints demands that it also be added topeerDependencies
. This is obviously incorrect.This commit addresses this (and other related constraints) by the following:
expectControllerDependenciesListedAsPeerDependencies
. This is the faulty constraint referred to above.expectDependenciesNotInBothProdAndDev
(nowexpectDependenciesNotInBothProdAndDevOrPeer
) to not only ensure that a dependency is not listed in bothdependencies
anddevDependencies
but also bothdependencies
andpeerDependencies
(onlydevDependencies
+peerDependencies
is allowed, as combinations go).expectPeerDependenciesAlsoListedAsDevDependencies
constraint to ensure that peer dependencies are also listed as dev dependencies.expectUpToDateWorkspaceDependenciesAndDevDependencies
to skip validation of "production" dependencies that are also listed in peer dependencies (this avoids conflicting constraints).expectConsistentDependenciesAndDevDependencies
to skip workspace dependencies, as that is already being handled byexpectUpToDateWorkspaceDependenciesAndDevDependencies
(this avoids conflicting constraints).Note that because of these changes, several controllers have also been
corrected to fit.
References
(N/A)
Manual testing steps
dependencies
without needing to add it topeerDependencies
. To test this:"@metamask/permission-controller": "^11.0.6",
todependencies
in the manifest for@metamask/accounts-controller
yarn constraints
dependencies
andpeerDependencies
. To test this:"@metamask/permission-controller": "^11.0.6",
todependencies
andpeerDependencies
in the manifest for@metamask/accounts-controller
yarn constraints
peerDependencies
(it must also be present indevDependencies
). To test this:"@metamask/permission-controller": "^11.0.6",
to justpeerDependencies
in the manifest for@metamask/accounts-controller
yarn constraints
dependencies
."@metamask/controller-utils": "^11.6.0",
yarn constraints
dependencies
.Changelog
(Updated in PR.)
Checklist