-
-
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
Move @storybook/addons
to peerDependencies in all addons
#2335
Conversation
Codecov Report
@@ Coverage Diff @@
## release/3.3 #2335 +/- ##
==============================================
Coverage ? 21.58%
==============================================
Files ? 339
Lines ? 7108
Branches ? 871
==============================================
Hits ? 1534
Misses ? 4924
Partials ? 650 Continue to review full report at Codecov.
|
addons/info/package.json
Outdated
@@ -14,7 +14,6 @@ | |||
"storybook": "start-storybook -p 9010" | |||
}, | |||
"dependencies": { | |||
"@storybook/addons": "^3.3.0-alpha.3", |
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.
It isn't actually used here
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.
Get it up to date with the latest alpha release all the way thru to push this out.
addons/links/package.json
Outdated
@@ -33,6 +32,7 @@ | |||
"shelljs": "^0.7.8" | |||
}, | |||
"peerDependencies": { | |||
"@storybook/addons": "^3.3.0-alpha", |
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.
should this be ^3.3.0-alpha.3
?
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.
It depends on whether we want to allow different versions of our packages to be used. If not, we should omit the caret in all cross-dependencies (direct and peer)
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, it turns out that lerna can update peerDeps as well, so I changed the version to the current one everywhere
# Conflicts: # addons/a11y/package.json # addons/actions/package.json # addons/events/package.json # addons/info/package.json # addons/knobs/package.json # addons/links/package.json # addons/notes/package.json # addons/options/package.json # addons/storyshots/package.json
Cannot wait to try this out! |
Issue: #1981 #1892
We need a single instance of
@storybook/addons
to be shared between addons and app.What I did
I moved the package to peerDeps in all the addons (some of them already had it there). There's no way to use addons without an app, so users still don’t have to install addons package on their side. Note that this relies on npm flattening the dependencies (the addons package is kept as a direct dep in apps)
A better solution would be to make the package a peerDep everywhere including the app, but that would be a breaking change, as users would have to install the package on their side.
How to test
I actually can’t find a good way to test that without publishing a new alpha version =(