fix: do not read configuration outside of the root #769
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.
Summary:
Reading configuration outside of the current working directory (in other words, project root), is not supported and can lead to dangerous errors. I was pretty sure we never supported that, until I've found this out today.
Since I was able to remove this functionality without changing any tests, my recommendation is to not include it until: a) there is such a requirement (validated) from the user-side and that b) we have thoroughly tested this behavior.
Context:
Fixes #655).
As per a comment from the above issue, the configuration is placed at the root of the repository whereas the CLI is run from the root of the project (which is different and resolves to
./packages/mobile
). That tiny difference is crucial and because paths in the configuration are always resolved relative to the root of the project, it creates silent issues that are hard to debug.I believe it's a good practice to require running the CLI from the root of the mobile project (where
react-native
is defined in thepackage.json
, just like Metro already does).Few workarounds relied on this mechanism to provide support for mono-repos (it was broken anyway). However, the PR #768 is going to address these cases by rolling out a new mechanism for this.