-
-
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
Create an official template for CRA #9327
Comments
@kevin940726 this sounds awesome! @mrmckeb WDYT? |
First of all, I think in the first stage we can support for both
If these all sounds good, I can go ahead and create a PR for this, then we can gather further feedbacks from there. |
But this is definitely a good idea - before we introduced it, I flagged this idea with @shilman and @ndelangen too. My only question is, what does the template do? What we want to discourage is a template for every tool in the ecosystem, and instead we want to encourage templates that are great starting points for new apps. So I'd ask that we try to ship something that's more than CRA with Storybook preconfigured (as we can do that already). Perhaps it could also include Redux and Styled-Components - or something along those lines? In short, if it's just SB init, I think it's hardly worth shipping... as we'll also then be responsible for the HTML template and some other core files that would regularly be updated on the CRA-side. On point 1, I think I'd prefix it with Storybook so people know it's official. On point 5, I think it should include docs on day one. What do you think @shilman? |
@mrmckeb For point 1, I think that requiring users to type
|
IMHO an advantage for storybook is that it's purely a development tool, we don't have to touch any of the files in the default template. Instead we just have to add those deps and some files to But yah it might seems like an overkill for creating a CRA template while we already can do those things today with |
I should double check, but I think you could just use Otherwise, I'm OK with just |
I'm not sure... We could use this to produce a best-practice template (the Storybook way)? |
I accidentally pressed comment, oops. My recommendation would be to make this template more tightly coupled with CRA, like integrating it with |
@mrmckeb I just ran it, and here's the output.
Looks like it's trying to install I'm aware of facebook/create-react-app#7991, judging from the changes, looks like this case is not handled. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi @kevin940726, that PR was merged and you should be able to continue this work now. Let me know if you hit any other template issues - as I was the one that built that feature, I can hopefully help! |
@mrmckeb Great! I'm wondering should we target this for 6.0 release though, as part of the features we can announce? |
I'd be OK with that. I'd like that we encourage stories alongside components in this template too. What do you think? |
@mrmckeb You mean putting |
Exactly @kevin940726 :) I think just alongside the component (Jest also allows you to put the test files alongside and use The other question would be - do we have a TypeScript template or JavaScript template - or both? |
@mrmckeb Agree! I would say both, |
Is your feature request related to a problem? Please describe.
Since CRA now supports custom template, I think it makes sense for us to create official template for CRA. It would make new comers easier to get started with storybook and CRA.
Describe the solution you'd like
We can create a new package
cra-template-storybook
and maintain it in this mono. We just have to follow the guide here, and the official template incra-template
andcra-template-typescript
.Describe alternatives you've considered
npx -p @storybook/cli sb init
works just fine, and we can continue support that for existing projects and for non-CRA projects. For new projects though, we can recommend users to just usecra-template-storybook
to get started.Are you able to assist bring the feature to reality?
Absolutely! I think it's fairly straight-forward. There are only some minor issues, like where should we put this project? A new directory
templates
? Insideexamples
(but it's not an example)? Or maybe just inlib
?Also since we can control the template now, we could create example component directly inside the template rather than using
@storybook/react/demo
. Would love to hear some ideas about this 🙂.Additional context
In short for what it would look like when landed. Users can simply run this command and get an CRA with storybook.
The text was updated successfully, but these errors were encountered: