-
-
Notifications
You must be signed in to change notification settings - Fork 52
Move MongoDB to peerDependencies #209
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
Comments
I am pretty much against the usage of |
I would prefer to put it into peerDependencies when node14 is deprecated and all supported node versions use npm version >= 7, which ensures that the peerDependencies exist by downloading them. Npm 6 in node 14 does not download the peerDependencies.... |
Peer dependencies are nothing but trouble. Particularly with the way they keep getting handled differently with seemingly every new npm release. |
I'm sincerely -1. They cause more problems than they are worth. Note that they would not give you any real benefits over a production dependency, because we would not specify a multi-major range. |
With no peerDependency, the dependency version can't be chosen (eg: use a specific version in case of bugs). Some sources: |
Eg: having v4 and v5, we have these use cases:
"peerDependencies": {
"mongodb": "^4.1.2" // random version of 4 --> version needed is >= 4.1.2
}
"peerDependencies": {
"mongodb": "^4" // support only version 4 --> version needed is one of 4
} or "peerDependencies": {
"mongodb": "^5" // support only version 5 --> version needed is one of 5
}
"peerDependencies": {
"mongodb": "^4 || ^5" // support both versions --> version needed is 4 or 5 (handle breaking changes in code if they are needed)
} |
Maintaining support for multiple versions and handling the breaking changes in the codebase is a (deliberate) non-goal. Maintaining those kind of support matrix is extremely hard, considering all the wrappers there are in this organization. All the other three versions have no benefit compared to equivalent versions for normal dependencies. All package managers correctly deduplicate those. |
I know, it's advised to update and use only latest (v5). |
Main problem is with multiple context (instance). From Using peer dependencies:
Understanding peer dependencies in JavaScript
If peerDependencies are used like a standard, there should be less headaches. |
This use case can't be deduped:
|
We should not support or facilitate using old and buggy software versions that should not include breaking changes. In my experience, peer dependencies are a major headache to maintain. |
Of course, but with that use case, when you install this plugin, you have no info (it's silent with any warning message or alert) or control that different versions of same dependency are installed. Please, can you write the headaches to mantain peer dependencies? Note: I think that this issue should remain opened or, at least, it should be converted in a discussion. |
I have had very hard to debug and resolve issues around the |
I think that every project is different (unique) and the improvements can be (re)considered because times change. |
Is there anyone who can reconsider? |
Prerequisites
Fastify version
4.14.1
Plugin version
6.2.0
Node.js version
16
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
11
Description
MongoDB should be moved from dependencies to peerDependencies
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: