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

CLI: Make template stories glob more permissive #9224

Merged
merged 1 commit into from
Dec 23, 2019

Conversation

shilman
Copy link
Member

@shilman shilman commented Dec 23, 2019

Issue: N/A

What I did

In Storybook we recommend users to colocate their stories with their components. However, in our CLI templates, we generate a stories glob which points to src/stories directory. As soon as users start adding stories next to their components, those stories won't show up, as their components are probably not in the src/stories directory. This PR updates the glob in all the templates to help minimize user confusion (with a hopefully small perf cost, unless they are working in a massive repo).

This is in response to a Slack support request from a user who had exactly this problem.

How to test

Verify CLI test run passes in CI

@vercel
Copy link

vercel bot commented Dec 23, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/heiwlklwt
🌍 Preview: https://monorepo-git-cli-update-stories-glob.storybook.now.sh

@shilman shilman added cli maintenance User-facing maintenance tasks labels Dec 23, 2019
@shilman shilman added this to the 5.3.0 milestone Dec 23, 2019
@shilman shilman changed the title CLI: Update stories glob to be more permissive CLI: Make template stories glob more permissive Dec 23, 2019
Copy link
Member

@ghengeveld ghengeveld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I never liked having stories in a separate directory. They should be colocated with the component.

@ghengeveld
Copy link
Member

Maybe we should not create a stories directory either?

@shilman
Copy link
Member Author

shilman commented Dec 23, 2019

@ghengeveld Yeah I don't like stories either, but wouldn't it be kind of crappy for storybook to put sample stories at the top level in an existing project?

@shilman shilman merged commit 1d44109 into next Dec 23, 2019
@shilman shilman deleted the cli-update-stories-glob branch December 23, 2019 09:04
@ndelangen
Copy link
Member

Do we dare making assumptions about where users put their components?

@ghengeveld
Copy link
Member

Well perhaps in case of a specific generator (CRA, Vue, Angular) we can make an educated guess. Anyway it's beyond the scope of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants