Skip to content
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: bring --projectRoot argument back to start #572

Merged
merged 3 commits into from
Jul 22, 2019
Merged

fix: bring --projectRoot argument back to start #572

merged 3 commits into from
Jul 22, 2019

Conversation

lior-frezi
Copy link
Contributor

Summary:

#496 by @thymikee fixed projectRoot from metro config got overriden by ctx.root. I think the real error was taking the root from ctx instead of args. previously, an option '--projectRoot' was enabled. the projectRoot from args should override the metro config, if it exists, like the other options of the cli. this PR makes the --projectRoot option work again. and, if not specified will use the config option.

Notify:

this should also help with storybook that previously used the --projectRoot option to start metro from the storybook root folder, instead of including it in your app (which is very non optimal and the recommendation as of now ). @shilman, @Gongreg is that right?

Test Plan:

create a react native project. set a projectRoot option in the metro config to a new file called a.js, check that it work. try using the cli with --projectRoot option set to a new file called b.js, it should override the metro config and load from b.js.

@Gongreg
Copy link

Gongreg commented Jul 22, 2019

Hey @liorJuice.

Currently we recommend --projectRoot as an alternative to including the storybook in the app itself (But first we recommend to add in in the app).

The better approach is to use customExtensions metro config for dev/prod build, but those are more difficult to explain.

If someone spent time to write a guide for proper way to set up additional code in your dev build, then we could remove suggesting --projectRoot.

@lior-frezi
Copy link
Contributor Author

@Gongreg isn't the sb init command used to add start-storybook -p 7007 | npm run start --projectRoot storybook to the project script by default? i thought that was changed because --projectRoot ceased to work.

@Gongreg
Copy link

Gongreg commented Jul 22, 2019

Oh, then we definitely should add back --projectRoot .

@thymikee
Copy link
Member

Thanks! Let's add it back for now, until we come up with better interface. Mind fixing type errors?

@thymikee thymikee changed the title Fix project root arg fix: bring --projectRoot argument back to start Jul 22, 2019
@thymikee thymikee merged commit 233a7a4 into react-native-community:master Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants