-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Add constraint to ensure controllers are peerDependencies #1393
Conversation
39149f0
to
7a3d5a6
Compare
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'peerDependencies') :- | ||
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'), | ||
DependencyIdent \= '@metamask/base-controller', | ||
DependencyIdent \= '@metamask/eth-keyring-controller', | ||
is_controller(DependencyIdent). |
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.
Since we're just interested in other workspaces, could we also write this as the following? Might remove the need for is_controller
.
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'peerDependencies') :- | |
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'), | |
DependencyIdent \= '@metamask/base-controller', | |
DependencyIdent \= '@metamask/eth-keyring-controller', | |
is_controller(DependencyIdent). | |
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'peerDependencies') :- | |
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'), | |
DependencyIdent \= '@metamask/base-controller', | |
workspace_ident(_, DependencyIdent). |
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.
Hmm, I think this would give us the wrong answer in two ways. We don't just care about workspaces here, we care about controllers. Controllers are singletons, regardless whether they live in this repo or not. But the other workspaces aren't. They're libraries that the clients can have multiple different versions of.
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.
I gotcha. That's fair.
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.
I was considering keeping it just to controllers in this repo, and adding another constraint to prevent depending on other controllers. Ideally any that are depended on here would be here. I guess we can consider that separately though.
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.
Looks good!
A constraint has been added to ensure that each controller that a package depends on is also added as a `peerDependency`. This helps us ensure that controllers appear only once in the dependency tree on the client repositories. Each controller is effectively a singleton because we only construct a single instance of each one. Typically they get added as dependencies only to get access to types in the controller package. If we don't add it as a `peerDependency` as well, it risks the versions getting out-of sync with what the client repository has installed. Any missing `peerDependency` entries have been added to comply with this constraint.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
a8778d1
to
663dc30
Compare
) * Add constraint to ensure controllers are peerDependencies A constraint has been added to ensure that each controller that a package depends on is also added as a `peerDependency`. This helps us ensure that controllers appear only once in the dependency tree on the client repositories. Each controller is effectively a singleton because we only construct a single instance of each one. Typically they get added as dependencies only to get access to types in the controller package. If we don't add it as a `peerDependency` as well, it risks the versions getting out-of sync with what the client repository has installed. Any missing `peerDependency` entries have been added to comply with this constraint. * Fix misleading local variable name Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> --------- Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
* Add constraint to ensure controllers are peerDependencies A constraint has been added to ensure that each controller that a package depends on is also added as a `peerDependency`. This helps us ensure that controllers appear only once in the dependency tree on the client repositories. Each controller is effectively a singleton because we only construct a single instance of each one. Typically they get added as dependencies only to get access to types in the controller package. If we don't add it as a `peerDependency` as well, it risks the versions getting out-of sync with what the client repository has installed. Any missing `peerDependency` entries have been added to comply with this constraint. * Fix misleading local variable name Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> --------- Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
* Add constraint to ensure controllers are peerDependencies A constraint has been added to ensure that each controller that a package depends on is also added as a `peerDependency`. This helps us ensure that controllers appear only once in the dependency tree on the client repositories. Each controller is effectively a singleton because we only construct a single instance of each one. Typically they get added as dependencies only to get access to types in the controller package. If we don't add it as a `peerDependency` as well, it risks the versions getting out-of sync with what the client repository has installed. Any missing `peerDependency` entries have been added to comply with this constraint. * Fix misleading local variable name Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> --------- Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Description
A constraint has been added to ensure that each controller that a package depends on is also added as a
peerDependency
. This helps us ensure that controllers appear only once in the dependency tree on the client repositories.Each controller is effectively a singleton because we only construct a single instance of each one. Typically they get added as dependencies only to get access to types in the controller package. If we don't add it as a
peerDependency
as well, it risks the versions getting out-of sync with what the client repository has installed.Any missing
peerDependency
entries have been added to comply with this constraint.Changes
None
Checklist