salesforce / salesforce/design-system-react

Use ES6 export for Storybook stories

Open
#2,207 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scale and productivity
Dominant language
JavaScript
Stars
982
Forks
440
Avg merge
1d 21h
Merged PRs (30d)
4

Description

.storybook/config.js:

import { configure } from ‘@storybook/react’;
configure(require.context(‘../src/’, true, /\.stories\.js$/), module);

Then the [component].stories.js file could also use a require.context and export all the files located in __examples__. This makes adding a story zero config by just adding a jsx file to a folder.

We will still want to identify which examples go on the doc site. Right now that is listed in the component.json file.

There's a code shift script for this: sb migrate storiesof-to-csf --glob "**/*.stories.js"

For more info:
https://medium.com/storybookjs/component-story-format-66f4c32366df

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .storybook/config.js and the existing [component].stories.js files, then review component.json for which examples appear on the documentation site. Use the referenced Storybook migration command as a guide, and consider the work done when stories can be discovered from the proposed example files while documentation-site selection remains defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.