-
-
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
Import demo components from @storybook/react #1303
Conversation
We do this so we can have a uniform way to do this across frameworks (e.g. RN, vue)
Codecov Report
@@ Coverage Diff @@
## master #1303 +/- ##
==========================================
- Coverage 13.76% 13.76% -0.01%
==========================================
Files 201 202 +1
Lines 4620 4621 +1
Branches 507 574 +67
==========================================
Hits 636 636
+ Misses 3550 3493 -57
- Partials 434 492 +58
Continue to review full report at Codecov.
|
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.
works fine for me!
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 works
still WIP? need to remove |
Thanks @usulpro . I forgot to remove them earlier |
@ndelangen @usulpro @alexandrebodin a test is failing but I don't have time to figure it out 😭
|
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.
We could create a demo.js in the root folder to reexport the components from dist ?
I don't like that user can access filles like this :(
Juste a preference no big deal for me ;)
Need to be offline for next four days. Would ❤️ if somebody could get this merged and shipped. @ndelangen @usulpro ? |
@@ -3,7 +3,7 @@ import React from 'react'; | |||
import { storiesOf } from '@storybook/react'; // eslint-disable-line | |||
import { action } from '@storybook/addon-actions'; // eslint-disable-line | |||
|
|||
import Button from '@storybook/components/dist/demo/Button'; | |||
import Button from '@storybook/react/dist/demo/Button'; |
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.
investigated that test fails after this change
not sure what the reason, possible someone who more familiar with storyshots could help?
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.
FYI these particular files are not tested by CI
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 fails at examples/test-cra/src/storyshots.test.js but after this change.
#2833 passed
#2836 failed
but possible it's more CI related issue then 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'm not sure why it sometimes passes to be honest, I would have thought it would consistently fail due to: #1303 (comment)
Looks good to me, what's failing the build? |
Cf. #1286 -- not sure this test passes on any branch with npm5. In this case the issue is that storyshots and the app have different copies of We should make storyshots show a better error if it finds no stories -- #1330 |
app/react-native/package.json
Outdated
@@ -28,7 +28,7 @@ | |||
"@storybook/addon-links": "^3.1.2", | |||
"@storybook/addons": "^3.1.2", | |||
"@storybook/channel-websocket": "^3.1.2", | |||
"@storybook/components": "^3.0.0", | |||
"@storybook/react": "^3.0.0", |
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.
Not sure we should be doing this
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.
Does RN use these components? AFAIK not (if so it should be changed in this PR).
@@ -3,7 +3,7 @@ import React from 'react'; | |||
import { storiesOf } from '@storybook/react'; // eslint-disable-line | |||
import { action } from '@storybook/addon-actions'; // eslint-disable-line | |||
|
|||
import Button from '@storybook/components/dist/demo/Button'; | |||
import Button from '@storybook/react/dist/demo/Button'; |
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.
FYI these particular files are not tested by CI
UpdateCurrently the build is broken because When we run the If we remove However, we are using demo components from |
This is a hack. Currently the build is broken because `test-cra` requires `@storybook/addon-storyshots` AND `@storybook/react`, but `@storybook/addon-storyshots` requires `@storybook/react`. Before this change, two versions of `@storybook/react` are getting loaded, and this leads to a test error “Your test suite must contain at least one test.” After this “fix” the error goes away. However, `@storybook/addon-storyshots` should have a dev- dependency on `@storybook/react`, because it uses it for its examples. But it only has a peer-dep for now.
Update againI have fixed the build with an unfortunate hack. This sucks, and is not technically correct, but it unbreaks the build. I am thinking about alternative approaches to this whole mess. |
Per discussion with @tmeasday 😉
As suggested by npm/npm#15900. This is a workaround until we get a better resolution of #1286
Use a pack -> install technique to recreate local packages
@alexandrebodin i missed your suggestion above about creating a |
Triumph!@tmeasday 's PR uses tarballs for In the words of @tmeasday :
|
Issue: #1266
What I did
Import demo components from
@storybook/react
instead of@storybook/components
We do this so we can have a uniform way to do this across frameworks
(e.g. RN, vue)
How to test
To make sure the deps work:
Does not test
getstorybook
, but I think we can assume that will work (but please review)