-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add node_module symlink support #1530
Conversation
Specifying project roots on the command line seem to override read natives detection of symlink'd node_modules.
Could this solve some of the problems we've been having too? #1301 |
It could, we're pretty much doing the same thing
If you're using windows you'll need to do the following:
If you're using linux/mac the symlink should just work once the packager has the new root. I've tested this PR and it does solve my problem. (at least on RN |
Codecov Report
@@ Coverage Diff @@
## master #1530 +/- ##
==========================================
- Coverage 21.41% 21.27% -0.15%
==========================================
Files 244 244
Lines 5402 5392 -10
Branches 663 656 -7
==========================================
- Hits 1157 1147 -10
+ Misses 3761 3760 -1
- Partials 484 485 +1
Continue to review full report at Codecov.
|
@mlabrum Thank you so much for this! Another stepping stone to getting storybook development in a amazing state! If you could have a look at the linting or add a |
Hey,
I'm glad I could give back :) I'll fix up that linting error
Cheers,
…On Fri, 28 Jul. 2017, 5:28 pm Norbert de Langen, ***@***.***> wrote:
@mlabrum <https://github.com/mlabrum> Thank you so much for this!
Another stepping stone to getting storybook development in a amazing state!
If you could have a look at the linting or add a eslint-ignore-next-line
or something we can get this merged I think.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1530 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASEqj-fcY7bhLvucIF67AHysfO7oTb4ks5sSZSkgaJpZM4Okzph>
.
|
This is quite clever, thanks for contributing this! I think many of us run into this problem. I, in particular, use Haul to gain the benefit of webpack. But having this support-built in is a nice frictionless experience. Can you think of any scenarios where this might cause problems, as the packager would normally skip symlinks? Wondering if it should be a configuration option that users can opt in or out of. |
@ajwhite this solution pretty much mocks what react native does when it loads its config I'm not sure how Haul would handle these extra project roots....but react natives packager will be fine |
@ajwhite Do you think you could test this for Haul and review & merge? |
I just took a look at this and it works great! With this change we can remove the RN apps from our list of "non-lerna-ed" things. Perhaps in a follow up PR. |
HOLY SMOKES, I'd say that calls for some 🎊 🎈 🎉 💯 @shilman you nightmare is over! |
Don't get the 🍾 out just yet, bootstrapping was creaking a bit when I tried to test it, but I confirmed that the basic problem (#1301) that caused us to do that was solved by this patch. |
I just have a question: |
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.
Looks good!
|
||
const projectRoots = (configDir === projectDir ? [configDir] : [configDir, projectDir]).concat(symlinks); |
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.
I think it'd be a good option somewhere to be able to specify a different project root through storybook-start
for those who have components and assets that need to be included from outside of the storybook root project.
It's definitely out of scope of this PR though so don't feel obligated to add this by any means. If it's a feature we want, I think a separate issue is an appropriate place to start.
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.
I agree, it would be nice to have, but probably belongs in a different PR
@Gongreg It's as safe as it could be, I've wrapped it in a try/catch...the only option around this would be to copy their code into the repo. it's probably the same level of risk as depending on |
@tmeasday Are you ready to approve this? |
Yes! |
Thank you @mlabrum for this PR! |
Issue:
If you have a symlink'd node_module then react-native adds that as a project root, as storybook is manually setting the project roots, storybook will need to detect the symlink and add it as a root
I've ran into this issue because we have a monorepo with symlink'd dependencies....
What I did
Edited the storybook start command to call the react-native symlink detection script and add those to the project root
How to test
Thanks!