-
-
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
Refactor framework-independent core library #2241
Conversation
Questionable changes: - ability to pass a story decorator function - pass clearDecorators to ConfigAPI React/Vue/Angular working (apparently). RN still broken.
Is the plan to move most of the server stuff over as well or should that be a separate package? |
app/react/src/client/preview/init.js
Outdated
@@ -1,11 +1,11 @@ | |||
import keyEvents from '@storybook/ui/dist/libs/key_events'; | |||
import { selectStory } from './actions'; | |||
import { Actions } from '@storybook/core/client'; |
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.
Would exporting & importing all actions individually be better 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.
I chose to bundle them to keep the namespace smaller. Open to counter-arguments.
lib/core/README.md
Outdated
@@ -0,0 +1,13 @@ | |||
# Storybook for React | |||
|
|||
[![Greenkeeper badge](https://badges.greenkeeper.io/storybooks/storybook.svg)](https://greenkeeper.io/) |
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.
outdated readme
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.
Fixed, though somehow it's not showing up here. Still need to write the actual contents and it's in the TODO list at top of PR.
Some ideas on how we could improve this further:
|
- resolve conflicts - fix RN story_store (make it an EventEmitter)
Codecov Report
@@ Coverage Diff @@
## release/3.3 #2241 +/- ##
===============================================
- Coverage 22.66% 22.18% -0.49%
===============================================
Files 346 338 -8
Lines 6767 6587 -180
Branches 887 856 -31
===============================================
- Hits 1534 1461 -73
+ Misses 4587 4483 -104
+ Partials 646 643 -3
Continue to review full report at Codecov.
|
@tmeasday Updated the binding per your suggestion. I didn't factor out Thanks! |
I was thinking just something like: import { init } from '@storybook/core/web';
init(); // <- we could pass args if ever needed to
// or even just
import '@storybook/core/init-web'; |
@tmeasday do you mean |
@Hypnosphi too fast off the mark there ;) Gotta give me time to fix my mistakes |
@danielduan long-term will refactor everything, including preview, manager, and server. starting with preview since that's where most of the action is. |
- move keyboard handling to the UI library, rather than introducing new deps - keep QS handling in each framework (for now)
Codecov Report
@@ Coverage Diff @@
## master #2241 +/- ##
===========================================
- Coverage 32.69% 19.07% -13.63%
===========================================
Files 398 324 -74
Lines 8837 7666 -1171
Branches 967 820 -147
===========================================
- Hits 2889 1462 -1427
- Misses 5271 5567 +296
+ Partials 677 637 -40
Continue to review full report at Codecov.
|
@tmeasday refactored |
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.
👏
Would this make it feasible for a framework author to integrate with Storybook? Is there a plan to make that possible? |
@shilman -- what's up with this PR? I was looking at making some core changes but it feels weird to touch code before this PR has been merged. Are we waiting to merge it post 3.3? |
Yes, we are @tmeasday, maybe you can base your work on this PR, or even on this branch? |
…factor Use store revisions to ensure that stories re-render on HMR.
Great to get this merged! Shall we open an issue to discuss the remaining refactoring candidates? |
Yes sounds good! |
=> #2636 |
Issue: #2240
What I did
Work in progress: first proof of concept for discussion
@storybook/core
libraryStill to-do:
How to test
Is this testable with jest or storyshots?
Does this need a new example in the kitchen sink apps?
Does this need an update to the documentation?
If your answer is yes to any of these, please make sure to include it in your PR.