-
Notifications
You must be signed in to change notification settings - Fork 106
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
Support configuration object for stories #182
Conversation
Looks OK to me! Why were the story titles removed? To test the recent title-auto-generation feature of Storybook? |
That's right. 😃 |
@IanVS @joshwooding what do you think, should we put this out there as version 0.2.0? |
9bec855
to
7470e47
Compare
I rebased this on master, and found that there's now another use of This presents a challenge, because we expected the stories to be globs, which we could send straight to vite to treat as entries. With this change, that's not possible, and we'd have to send the full list of files. Which I guess is fine? I'll try it out and see how it works. |
OK, I pushed up a fix for that issue, but identified another. This PR only works when |
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.
This needs to work without storyStoreV7
enabled.
As another datapoint, I found earlier today that automatic titles only works when this flag is enabled as well.
Pretty sure we're waiting on #76 for automatic titles without storyStoreV7 |
If that's the purpose of #76, so far it's not working. I'm not completely clear what the goal of that PR is though. Anyway, I'll let @kazuma1989 decide whether this is worth removing my last commit that removes |
I think you’re right, we should aim to get #76 merged before releasing 0.2.0 |
e9e3b8e
to
e9dc4e0
Compare
OK, I dropped the commit which had removed storyStoreV7. I think we can probably merge this, and then figure out what's going on there with the rest of auto-title generation. |
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.
@IanVS @eirslett @kazuma1989 I've bumped the @storybook/* packages to 6.4 here since we require the peerDep to be >=6.4.0
The "path" argument must be of type string
The "path" argument must be of type string
The "path" argument must be of type string
845eb31
to
e2a1f3e
Compare
It's definitely not working correctly, I made some notes on what I've found so far: #201. |
Fixes #201 This enables the omission of `title` properties in the default export of stories (the new storybook "autotitle" feature). It's a little less powerful without #182, but it's still nice to support this, I think. I did notice an issue with HMR, but it seems not to be introduced in this PR, but exists in the react example on main as well. Changing a css value _does_ still HMR, so I think there is no regression here.
5589036
to
5ab666a
Compare
5ab666a
to
992ef8c
Compare
@joshwooding @eirslett Since we're moving from |
@IanVS Makes sense to me 👍🏽 |
Makes sense to me too! |
Hah, so turns out we already only support sb 6.4+, since #218 (0.1.17). Oops. Since we haven't heard any complaints, I propose we just make this official (put it in the README), and if anyone needs 6.3 support we can point them to 0.1.16. Then, we can merge this and release without a breaking semver change. WDYT? |
`files` is optional. The default value is `'**/*.stories.@(mdx|tsx|ts|jsx|js)'`.
Use normalizeStories.
Stories written in MDX or importing MDX must have title.
992ef8c
to
8b69ba8
Compare
Makes sense to me. I've rebased the PR to help. |
8b69ba8
to
8bbd2b1
Compare
Just curious, why 6.4.3 for the @storybook/* dependencies? |
This PR was to match the peerDependency but not sure why it was chosen there. |
Strange, it looks like it was added in the PR that converted us to typescript. https://github.com/storybookjs/builder-vite/pull/195/files#diff-7bcd234238498627a82d47315d21db88a6433dd4eb978c99c8397387e1e7d0caR30 @mrauhu do you recall why this version was added to peerDependencies, instead of say, At any rate, let's get this released, and we can change the ranges later if we decide to. |
Thanks @kazuma1989 for your work here, and for your patience! |
@IanVS because this version based on the real version value in Lines 2997 to 2999 in 1d1360e
|
Issues
Fixes #77.
Hi, maintainers and contributors!
After #172, I found another issue relating Storybook 6.4.
As of Storybook 6.4,
stories
can be an array ofStoriesSpecifier
object, but the builder can't handle it.The
StoriesSpecifier
is defined and used below.https://github.com/storybookjs/storybook/blob/80410528e8911ec4e1708899aec96ae8196d829e/lib/core-common/src/types.ts#L377-L382
https://github.com/storybookjs/storybook/blob/80410528e8911ec4e1708899aec96ae8196d829e/lib/core-common/src/types.ts#L257-L274
The code above should be OK but will raise an error saying:
Reproduction
You can see it by checking out the commit
9fed56c1e321abf7e4089fb4c9fe78b1460b5092
and running the following command.Resolution
Using
normalizeStories()
imported from@storybook/core-common
has resolved the issue.The implementation is based on the one in
@storybook/builder-webpack5
.https://github.com/storybookjs/storybook/blob/80410528e8911ec4e1708899aec96ae8196d829e/lib/builder-webpack5/src/preview/iframe-webpack.config.ts#L92-L95
I added the@storybook/core-common
package as a peer dependency.All the Storybook's base packages (@storybook/react
,@storybook/svelte
,@storybook/vue
and so on) are depends on the package.So it will be OK, I think.FIX
normalizeStories
is needed to have more control over auto-title-generation, introduced in Storybook 6.4.cf. https://storybook.js.org/blog/component-story-format-3-0/
Therefore,
normalizeStories
is not necessary for users of version 6.3 who only specify an array of strings forstories
.Removed
@storybook/core-common
from peer dependencies.And now use
normalizeStories
only when it is available, and use simple logic to match types when it is not.Both version 6.3 and 6.4 will work.
Thanks.