-
Notifications
You must be signed in to change notification settings - Fork 349
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: Disable updating peer dependencies when updatePeerDependencies is false. #2270
fix: Disable updating peer dependencies when updatePeerDependencies is false. #2270
Conversation
\t\t"foo": "~0.1.0" | ||
\t}, | ||
\t"peerDependencies": { | ||
\t\t"bar": ">= 1.0.0" |
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.
Test that validates the peer dependency is not updated.
const packageJson = new PackageJson({ | ||
version: Version.parse('14.0.0'), | ||
versionsMap, | ||
updatePeerDependencies: true, |
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.
This test implicitly dependended on the updater always updating the peer dependencies. So it was updated and produces the same output.
snapshot(newContent.replace(/\r\n/g, '\n')); | ||
}); | ||
|
||
it('does not update peer dependencies by default', async () => { |
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.
New test which does not update peer dependencies.
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.
Thank you!
The "updatePeerDependencies" option currently operates as a "considerPeerDependencies" option. What this means is that if a package only has a peer dependency on another, then that will not be considered and no update will be made (as if there was no dependency). If a package has a peer dependency as well as another dependency, for instance a dev dependency, then the peer dependency is updated regardless.
This propagates the "updatePeerDependencies" option to the PackageJson updater so that it can omit updates to the peer dependencies.
It isn't completely clear what the intended behavior here is. This update behavior matches my current use-case, but it is possible it could be a problem for others. In which case there could be two different options (but the current name does seem like it would impact peer dependency updates.)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #2269
🦕