Skip to content

Instantly share code, notes, and snippets.

@shilman
Last active May 13, 2021 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shilman/63ce375a09e02afbd87f750cc90e811b to your computer and use it in GitHub Desktop.
Save shilman/63ce375a09e02afbd87f750cc90e811b to your computer and use it in GitHub Desktop.
SB Repro Alpha

Storybook Repro Alpha

To streamline bug reporting and maintenance, we're introducing a standardized repro process in Storybook. The process is now in alpha, and we'd love your feedback to make it better before we introduce it to the community at large. Thank you for your help!!!

The process is automated by two new commands:

  • sb repro - create a new repro based on a template
  • sb link - download a repro and link it against the storybook monorepo to interactively develop a fix against it

Step 1: creating a reproduction

To create a reproduction, run the repro command:

npx sb@next repro

This will prompt you for a destination directory and a template. Using standardized templates help us isolate the conditions required to trigger a bug.

It also takes CLI flags. For example the following will initialize a CRA-based repro:

npx sb@next repro --template cra repro-cra

Step 2: upload your repro to github

Create a public github repository and upload your code. We have not automated this step yet and are open to suggestions on the best way to do this.

Step 3: link your repro to your storybook monorepo

To run and develop against a repro, run the link command from the root directory of the storybook monorepo:

npx sb@next link git@github.com:shilman/repro-cra.git

This will create a file ../storybook-repros/repro-cra, link in the current monorepo workspace, and then run the storybook.

This means that if you run

yarn build components addon-docs addon-controls --watch

And edit files in the monorepo, these changes will be immediately reflected in the repro storybook. Note that Storybook's manager UI (the UI around the iframe) does not HMR, so if you're editing that you'll need to reload the browser.

Feedback wanted

If you try out the flow and have ideas for how to improve it, please file a github issue. This process is brand new and still untested, and we'd like to make it great. Thank you!!!

@zol
Copy link

zol commented May 11, 2021

This is great!

In step 2, did you mean "Create a public repo"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment