-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Core: Add Yarn 2 compatibility #9667
Conversation
Love this @gaetanmaisse !!! Can you reuse an existing example? |
@shilman maybe I still need to do a few more tests before setting this PR as ready but I think there will not be many more code changes on
|
Yeah I’d say do both! CRA because it’s kind of “special” and one of the others to have a “normal” example. Would be nice to have one that tests typescript support too. If this is the future of yarn, doing a few should be fine. As long as we also have a few old-style examples around too |
31da6b2
to
f938709
Compare
I open this PR because with these commits everything should be OK for Yarn 2 & Storybook compatibility on simple projects. @shilman I didn't find a way to use Yarn 2 on only some projects of our Yarn v1 workspace. As soon as this PR will be merged and released I will add an e2e test on Yarn 2 repo matching the scenario given in the issue. Then I will work on:
|
@gaetanmaisse This is really awesome work -- will be so great to announce this as part of the 6.0 release. 🤩🤩🤩 I'm not tracking the yarn 2 situation closely, but based on my limited understanding, we will need to support both yarn 1 and 2 for the foreseeable future. Therefore here's my strawman proposal, assuming that yarn 2 will be the primary use case moving forward, and yarn 1 will be the secondary:
What do you think? Alternatively, if I got the primary/secondary cases wrong, we can flip the proposal. NOTE: To clarify, what I'm proposing is followup work, and not required for this PR. 😃 |
@@ -41,7 +41,20 @@ | |||
"qs": "*", | |||
"rax": "*", | |||
"react": "*", | |||
"vue": "*" | |||
"vue": "*", |
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.
@gaetanmaisse this PR somehow got removed: #7675
Do you think I should reapply that first before this PR? Would it change this part of this PR?
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 we can keep it as it is and as it will be with this PR, from my point of view it's more semantically correct to have preact
, rax
and vue
listed as peerDep as we are importing them in the source code of addon-context
(in addons/contexts/preview/framework
). Adding the peerDependenciesMeta
info will prevent any npm/yarn warning about missing dep which was the main point of #7625 and #7625 (comment).
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.
OK cool
@shilman I like your proposal! I will add to my todo list to investigate it 🕵 . It is maybe a bit too ambitious to migrate our workspace to Yarn 2 right now because:
Anyway, I will take a look at what is possible and I will share my feedback and thoughts 😉 |
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.
LGTM. Could use confirmation from @ndelangen or somebody else who's more familiar with the situation.
…ook cache directory `find-cache-dir` is not used anymore because it returns `undefined` when there is no `node_modules` folder at project root, as in projects managed with Yarn 2.
…kage folder to SB cache folder Using Yarn 2 packages are read only, and more globally it's better to not alter the package with its own execution, so the output is moved outside the packages.
Add PnpWebpackPlugin in manager and preview webpack configurations
Yarn 2 introduce an error for this during `yarn install`: YN0002 - MISSING_PEER_DEPENDENCY For details see https://dev.to/arcanis/implicit-transitive-peer-dependencies-ed0 TL;DR: If you write a package that depends on Foo, and if Foo has a peer dependency, then you must provide it in either of the dependencies or peerDependencies fields. You won't "implicitly inherit" the peer dependencies declared in Foo.
33864ca
to
a978bd2
Compare
Issue:
Part of #9527
🏗 Some changes will also be needed on CRA preset to make it compatible.
What I did
outputDir
outside@storybook/core
packageHow to test
@storybook/core
package.json
file add your local version of@storybook/core
:yarn install
yarn storybook
and 🎉🎉--
Does this need a new example in the kitchen sink apps?
--> I think so, but for now, I didn't find a way to use Yarn v2 on some project of our Yarn v1 workspace.