-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Restore isolated @automattic/components
Storybook
#97988
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
@@ -87,7 +87,7 @@ | |||
"clean:packages": "yarn workspaces foreach --all --parallel --verbose --exclude 'wp-calypso' run clean", | |||
"clean:public": "rm -rf public", | |||
"clean:translations": "rm -rf build/strings calypso-strings.pot chunks-map.*.json || true", | |||
"components:storybook:start": "echo 'Storybook in Calypso moved into the root directory. Run `yarn storybook:start` instead.'", | |||
"components:storybook:start": "echo 'Deprecated, run `yarn workspace @automattic/components run storybook` instead'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more consistent with the other *:storybook:start
scripts, e.g. composite-checkout:storybook:start
.
@@ -41,6 +41,4 @@ in the root of the repository to get the required `devDependencies`. | |||
|
|||
### Using [Storybook](https://storybook.js.org/) | |||
|
|||
To see stories within this package, run `yarn workspace @automattic/components run start-storybook`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start-storybook
no longer works in Storybook 7+.
@@ -41,6 +41,4 @@ in the root of the repository to get the required `devDependencies`. | |||
|
|||
### Using [Storybook](https://storybook.js.org/) | |||
|
|||
To see stories within this package, run `yarn workspace @automattic/components run start-storybook`. | |||
|
|||
To see all stories within this repository, run `yarn storybook:start` at the root of the repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is untrue, as the root Storybook only includes a subset:
Lines 6 to 11 in 8be8e8b
stories: [ | |
'../client/**/*.stories.{js,jsx,ts,tsx}', | |
'../packages/design-picker/src/**/*.stories.{ts,tsx}', | |
'../packages/components/src/**/*.stories.{js,jsx,ts,tsx}', | |
'../packages/domains-table/src/**/*.stories.{js,jsx,ts,tsx}', | |
], |
@@ -84,6 +85,7 @@ | |||
"scripts": { | |||
"clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && rm -rf dist", | |||
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && copy-assets", | |||
"prepack": "yarn run clean && yarn run build" | |||
"prepack": "yarn run clean && yarn run build", | |||
"storybook": "sb dev" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script structure is consistent with the other packages that offer an isolated Storybook, e.g. launchpad
or composite-checkout
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks 👍 🚀
I'd say ideally, there should be a central storybook instance as well, one where you can see all stories from the entire monorepo, but that can be done separately.
Proposed Changes
Restores ability to launch the
@automattic/components
Storybook in isolation.Why are these changes being made?
The documentation was outdated.
#76007 moved the component stories into the root Storybook, and soon after #76794 restored the ability to launch the component stories in isolation. However, the README instructions are now outdated, likely due to the Storybook 7 upgrade.
Testing Instructions
yarn workspace @automattic/components run storybook
to launch the isolated Storybook.Pre-merge Checklist