Support specifying the react-native cli config #1861
Closed
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.
Issue
Previously it was not possible to get sufficient control over the roots
that the react-native CLI would use. Specifically in the case when the
projectDir and configDir are the same, but it's desirable for the
packager to resolve symlinks one level up in the directory hierarchy.
Our specfic case is this. We have a Lerna monorepo where we end up with a symlink that traverse the directory structure one level up for native packages. The method added in #1530 is not sufficient as it only considers the node_modules at
native/node_modules
, but not any ofnative/packages/*/node_modules
where the actual symlinks are located. The code is available hereWhat I did
I've added a new flag to
storybook-start.js
,--react-native-config
which is the path to a react native CLI config. When specified it will be passed to the react native cli start invocation. It also disables certain other flags passed such as--projectRoots
and--root
as these will otherwise override what's specified in the config.For our codebase this means we've gone frome
to
using the following
rn-cli.config.js
How to test
Is this testable with jest or storyshots?
The rest of
storybook-start.js
is not covered by test so I have not added any, but I'm happy to do so.Does this need a new example in the kitchen sink apps?
No idea
Does this need an update to the documentation?
Yes most likely the behaviour around the
--react-native-config
flag needds to be documented.If your answer is yes to any of these, please make sure to include it in your PR.
I'll do this given you are okay with this approach
Thanks for an awesome project 🎉