-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: add optional peer dependencies (yarn2/pnpm) #2606
Conversation
For clarity,
|
Hi @andreialecu, thanks for your contribution. Unfortunately, for the 3.6.x series we need to continue to support Node Argon so I don't think this approach will work. I just tried it locally, and npm automatically installs all of the peer dependencies which is explicitly what we're trying not to do. Are you unable to use the driver with |
Hey @mbroadst, thank you for explaining. I didn't consider the need to support I have simplified the PR to only add the See:
|
require_optional
and add aws4
Yarn 2 users can use an override mechanism called See: https://yarnpkg.com/getting-started/migration/#fix-dependencies-with-packageextensions |
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.
Thanks for the clarification @andreialecu , this looks good to me. Hopefully we'll all be able to move to v4 shortly, where we won't have this issue!
Hi Team, sounds like you resolved the issue using I did some up with this. packageExtensions:
"mongodb@*":
dependencies:
bson-ext: "*"
kerberos: "*"
"@mongodb-js/zstd": "*"
aws4: "*"
mongodb-core: "*"
bson: "*"
node-gyp: "*"
"mongodb-client-encryption": "*"
peerDependenciesMeta:
"@mongodb-js/zstd":
optional: true
snappy:
optional: true
bson-ext:
optional: true
kerberos:
optional: true This got me past a few errors but now I just get this crazy mess.
Notice how it's just trying to load every possible operating systems match for both How has anyone managed to get this library to work with Yarn PnP? Can we please get some examples documentation. I submitted an issue here as this repo doesn't have a issue section? |
Description
It appears that
aws4
was being required without being listed as a dependency. This results in errors when using strict package managers such as Yarn 2 (berry) and pnpm.Additionally, it seems a non-standard way of requiring optional modules was being used.All recent package managers support optional peer dependencies using the
peerDependenciesMeta
field:npm as of: npm/cli#224
Yarn 1: https://classic.yarnpkg.com/en/docs/package-json#toc-peerdependenciesmeta
Yarn 2: https://yarnpkg.com/configuration/manifest/#peerDependenciesMeta
pnpm: https://pnpm.js.org/en/package_json#peerdependenciesmeta
What changed?
Removedrequire_optional
dependency and used standard optional peer dependency definitions.Added
aws4
as an optional peer dependency. See:https://yarnpkg.com/advanced/rulebook/#packages-should-only-ever-require-what-they-formally-list-in-their-dependencies
Are there any files to ignore?
No