question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create an official template for CRA

See original GitHub issue

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 in cra-template and cra-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 use cra-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? Inside examples (but it’s not an example)? Or maybe just in lib?

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.

npx create-react-app --template storybook

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:16 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
kevin940726commented, Mar 3, 2020

@mrmckeb Agree!

I would say both, @storybook/cra-template and @storybook/cra-template-typescript.

1reaction
kevin940726commented, Mar 3, 2020

@mrmckeb You mean putting Button.js and Button.stories.js in the same directory? I’d love that, personally I’ve never used an universal stories folder ever. Either putting them inside the same directory, or following the convention in Jest and put stories inside a nearest __stories__ folder along side the component. It could be too complicated for a template to do the latter though, in practice, I’d expect to put stories at the same place as tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Templates - Create React App
Custom Templates enable you to select a template to create your project from, while still retaining all of the features of Create React...
Read more >
cra-template-* - npm search
cra -template-npm-library. Create React App template to build and publish NPM libraries with rollup, eslint and stylelint · morewings ; cra-template-eventrix. The ...
Read more >
Use Your Own Template With Create-React-App - codeburst
create -react-app is an amazing tool, described as the best way to start building a new single-page application in React, inside the official...
Read more >
How to create custom Create React App (CRA) templates
3.1 Create template/ folder · 3.2 Add gitignore file to the template/ folder · 3.3 Create `template.json` at your project root · 3.4...
Read more >
Create your own Create React App template
Start by creating a folder called cra-template . · Cd into the folder and run yarn init -y or npm init -y if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found