[PLAT-4872] Swap to a peer dependency on bugsnag/core in plugins #1012
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Currently our plugins have a hard dependency on
@bugsnag/core
. This can lead to issues when a plugin is updated separately to@bugsnag/core
, because NPM will dutifully install multiple copies of@bugsnag/core
— the original version will remain and the plugin will get a newer version of its own. Typically this shouldn't be a problem because changes will be backwards compatible, but it can cause issues for type declarations as a newer@bugsnag/core
may be incompatible with an old@bugsnag/core
To prevent having multiple copies of
@bugsnag/core
, we can usepeerDependencies
instead of a hard dependency. This should mean that there is only ever one top-level version installed, which will be pulled in by@bugsnag/js
,@bugsnag/expo
or@bugsnag/react-native
Design
I went with a version constraint of
^7.0.0
to be as compatible as possible, but I think this could be^7.3.0
(or even the version this is released in (^7.4.0
?)) because there shouldn't be a scenario where a new plugin version is installed with an old version of core — not 100% sure this is a good idea though!Changeset
delivery-
andplugin-
packages no longer have a hard dependency on@bugsnag/core
delivery-
andplugin-
packages have a dev dependency on@bugsnag/core
delivery-
andplugin-
packages have a peer dependency on@bugsnag/core
Testing
This should be covered by existing tests