Skip to content
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 CSF3 automatic titles #77

Closed
thebuilder opened this issue Jul 23, 2021 · 2 comments · Fixed by #182
Closed

Support CSF3 automatic titles #77

thebuilder opened this issue Jul 23, 2021 · 2 comments · Fixed by #182

Comments

@thebuilder
Copy link

Storybook 6.4 introduces a new way to find stories, to support automatic title generation for CSF3.
This currently breaks in the Vite builder, since it assumes the paths are always strings.

module.exports = {
  stories: [
   { directory: '../src', files: '*.story.tsx', titlePrefix: 'foo' },
  ]
};

This throws an error:
image

Caused by this line:
https://github.com/eirslett/storybook-builder-vite/blob/main/packages/storybook-builder-vite/codegen-iframe-script.js#L33

Stories can also be defined in a shorter string manner, but this will also break. The magic globbing logic should be applied to this one.

module.exports = {
  stories: ['../src']
};

Results in:
image

@IanVS
Copy link
Member

IanVS commented Jul 23, 2021

This is being addressed in #76.

@shilman shilman changed the title Support Storybook 6.4 stories Support Storybook 6.4 main.js stories Jul 23, 2021
@shilman shilman changed the title Support Storybook 6.4 main.js stories Support CSF3 automatic titles Jul 23, 2021
@IanVS
Copy link
Member

IanVS commented Jan 4, 2022

Oops, I pointed to the wrong PR, it's actually #182.

IanVS pushed a commit that referenced this issue Apr 10, 2022
# 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 of `StoriesSpecifier` 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

```js
module.exports = {
  stories: [
   { directory: '../src', files: '*.story.tsx', titlePrefix: 'foo' }
  ]
};
```

This PR enables that syntax.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants