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
Feature Request: Extend package.json
configuration search beyond first file found
#439
Comments
@mhassan1 it would need to be debated if the first found should take higher priority, or the last found i guess currently it is this way because of these problems (which hierarchy & conflicting configs) |
Definitely, this will be very useful for workspaces & monorepos.
Only a lack of logging information can stop us. It's too bad when the library works somehow weird and you cannot understand why.
It's a very interesting question. I think that we need to use the first found config. I think that merging can contain bugs and hard for resolving on the end-users side. Anyway, we may start from the first found and in the future improve it by adding merge logic. BUT for this, we need to gather more real use cases when merging really worth it. @mhassan1 if you have a good example of why needs merging (which properties should be on what levels in your repo) - please share with us. Tnx. |
I actually don't have a use case for merging multiple files, and I agree that it could be harder for the user to understand. I will offer a PR on |
package.json
files in the hierarchy instead of stopping at the first one foundpackage.json
configuration search beyond first file found
LGTM. Thanks for the quick turnaround. |
🎉 This issue has been resolved in version 7.0.0-beta.18 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 7.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Versions
package:
mongodb-memory-server-core
What is your question?
In
resolve-config.ts
, we look for the closestpackage.json
and stop when we find it (even if it doesn't contain any configuration information):mongodb-memory-server/packages/mongodb-memory-server-core/src/util/resolve-config.ts
Lines 23 to 27 in 2bc5128
In the case of a monorepo, the configuration for the postinstall script must be in the root of the monorepo (since
INIT_CWD
is the root), but the configuration for the package in thepackages
directory of the monorepo must be in thepackage.json
in that package (since theprocess.cwd()
is the package). We need to include the same configuration in both places.It would be useful to be able to include the configuration only in the root so it takes effect in both situations. A couple of ways we could do it:
findPackageJson
to merge allpackage.json
files that it finds as it traverses up the hierarchy. It could be something like:package.json
that containsconfig.mongodbMemoryServer
The text was updated successfully, but these errors were encountered: