-
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
Storybook: Exclude costly and broken stories #99389
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
@okmttdhr @fushar @wojtekn Are these stories still worth fixing? I have a stub branch where I fixed most immediate issues, but I don't want to spend too much time on this if it isn't critical. Or maybe you're aware of something in the chain that changed to break these stories. |
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. |
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.
The savings in time are much greater than I expected!
The proposed approach seems sensible to me, let's understand if the stories in my-sites/
and sites/
are still relevant / used before potentially fixing them and adding them back.
.storybook/main.js
Outdated
@@ -4,7 +4,13 @@ const storybookDefaultConfig = require( '@automattic/calypso-storybook' ); | |||
|
|||
const storybookConfig = storybookDefaultConfig( { | |||
stories: [ | |||
'../client/**/*.stories.{js,jsx,ts,tsx}', | |||
'../client/components/**/*.stories.{js,jsx,ts,tsx}', |
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.
I'd prefer to keep this as it was, so folks can still add stories in other dirs.
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.
Unfortunately Storybook is still having trouble combing through the entire client/
folder for some reason. I bisected through the top-level subfolders to check what the bottlenecks were, and there were a lot 🤔
'../client/__mocks__/**/*.stories.{js,jsx,tsx}',
'../client/a8c-for-agencies/**/*.stories.{js,jsx,tsx}',
'../client/assets/**/*.stories.{js,jsx,tsx}',
'../client/auth/**/*.stories.{js,jsx,tsx}',
'../client/blocks/**/*.stories.{js,jsx,tsx}',
'../client/boot/**/*.stories.{js,jsx,tsx}',
'../client/components/**/*.stories.{js,jsx,tsx}',
'../client/controller/**/*.stories.{js,jsx,tsx}',
'../client/data/**/*.stories.{js,jsx,tsx}',
'../client/devdocs/**/*.stories.{js,jsx,tsx}',
'../client/document/**/*.stories.{js,jsx,tsx}',
'../client/gutenberg/**/*.stories.{js,jsx,tsx}',
'../client/hosting/**/*.stories.{js,jsx,tsx}',
'../client/incoming-redirect/**/*.stories.{js,jsx,tsx}',
'../client/jetpack-app/**/*.stories.{js,jsx,tsx}',
'../client/jetpack-cloud/**/*.stories.{js,jsx,tsx}',
'../client/jetpack-connect/**/*.stories.{js,jsx,tsx}',
// '../client/landing/**/*.stories.{js,jsx,tsx}',
'../client/launchpad/**/*.stories.{js,jsx,tsx}',
// '../client/layout/**/*.stories.{js,jsx,tsx}',
// '../client/lib/**/*.stories.{js,jsx,tsx}',
'../client/login/**/*.stories.{js,jsx,tsx}',
'../client/mailing-lists/**/*.stories.{js,jsx,tsx}',
// '../client/me/**/*.stories.{js,jsx,tsx}',
// '../client/my-sites/**/*.stories.{js,jsx,tsx}',
'../client/node_modules/**/*.stories.{js,jsx,tsx}',
'../client/notifications/**/*.stories.{js,jsx,tsx}',
// '../client/performance-profiler/**/*.stories.{js,jsx,tsx}',
'../client/post-editor/**/*.stories.{js,jsx,tsx}',
'../client/reader/**/*.stories.{js,jsx,tsx}',
'../client/server/**/*.stories.{js,jsx,tsx}',
// '../client/signup/**/*.stories.{js,jsx,tsx}',
'../client/site-profiler/**/*.stories.{js,jsx,tsx}',
// '../client/sites/**/*.stories.{js,jsx,tsx}',
'../client/sites-dashboard/**/*.stories.{js,jsx,tsx}',
// '../client/state/**/*.stories.{js,jsx,tsx}',
'../client/support/**/*.stories.{js,jsx,tsx}',
'../client/switch-site/**/*.stories.{js,jsx,tsx}',
'../client/test/**/*.stories.{js,jsx,tsx}',
'../client/test-helpers/**/*.stories.{js,jsx,tsx}',
All of the commented out subfolders add a non-negligible amount of time to the Storybook startup. For now I think it would be wise to keep this an opt-in at the subfolder level. Although we could technically make an exclude list from the known bottleneck subfolders, it would be annoying to debug once another bottleneck emerges.
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.
Ah, that's a bummer, but it makes sense if it has a major impact on build time 👍
.storybook/main.js
Outdated
// TODO: Excluding these paths for now as they are currently broken and | ||
// also add an extreme amount of time to the Storybook startup. | ||
// '../client/my-sites/**/*.stories.{js,jsx,ts,tsx}', | ||
// '../client/sites/**/*.stories.{js,jsx,ts,tsx}', |
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.
I vote for deleting those broken stories altogether.
I don't see much value in having these stories anyway, even if they were working.
We can also remove the ReduxDecorator
and any other unused supplementing utils.
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.
Confirmed with @taipeicoder that we can delete them.
Done in 75d8c10
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.
LGTM!
Great cleanup, thanks @mirka 🚀
@mirka I've added an issue https://github.com/Automattic/dotcom-forge/issues/10433 so we can check the effort to bring those back. |
Proposed Changes
Temporarily exclude broken stories from the main Storybook.
Why are these changes being made?
The
client/**
glob currently matches three subfolders:components
my-sites
sites
The stories in
my-sites
(ActivationModal) andsites
(StagingSiteCard) do not build properly. Plus, Storybook takes forever to start up when these two paths are included. I am inclined to temporarily exclude them if they are not being actively used or maintained.Testing Instructions
Confirm that
yarn storybook:start
now boots the main Storybook instance in a reasonable amount of time.Pre-merge Checklist