Skip to content
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 6 and config changes #75357

Merged
merged 70 commits into from
Sep 30, 2020
Merged

Storybook 6 and config changes #75357

merged 70 commits into from
Sep 30, 2020

Conversation

smith
Copy link
Contributor

@smith smith commented Aug 18, 2020

Upgrade to Storybook 6 and attempt to use the declarative configuration.

The goals of this PR (as part of Kibana's Storybook roadmap, are:

  • Upgrade to Storybook 6
  • Still allow running Storybooks with yarn storybook plugin_name
  • Use the declarative configuration to (hopefully) make the configuration simpler to use an easier to understand, as well as avoiding deprecation warnings and loss of future compatibility

The ways in which what I have so far differs from how we do things today are:

  • In the alias configuration it takes a path to a storybook configuration directory instead of the storybook.js file from before
  • Each plugin (it doesn't have to be a plugin; can be any directory) has a .storybook/main.js (the aliases file in @kbn/storybook specifies these locations) where they can define their Storybook configuration. You can require('@kbn/storybook').defaultConfig to get defaults and override them
  • @kbn/storybook has a preset that can provide Webpack and Babel configuration and Storybook parameters and decorators
  • Instead of dynamically creating the list of stories to import, we define them in the globs of the stories property in .storybook/main.js.
  • Do not build a DLL. We are using @kbn/ui-shared-deps as externals. Startup time is not quite as fast but still acceptable.

Other things done in this PR:

  • Allow default exports in .stories. to allow for Common Story Format CSF stories
  • Add guard in Webpack configuration needed for overriding CSS rules
  • Update filename casing check to allow for files with required names in Storybook
  • Clean up observability stories
  • Rename *.examples.tsx and *.story.tsx to *.stories.tsx

TODO:

  • Change alias configuration for all stories and make them work
  • You need to run scripts/storybook --dll in canvas first to make that story work, and withInfo has been removed.
  • Use @kbn/ui-shared-deps
  • Set up Storybook essentials to replace knobs and info addons
  • Remove deprecation warning change from exit_on_warning
  • Remove old unused addons
  • Ensure stories aren't double-adding decorators, by converting to CSF or other means
  • Verify everything works

@smith smith added release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Aug 19, 2020
@smith
Copy link
Contributor Author

smith commented Sep 15, 2020

retest

1 similar comment
@smith
Copy link
Contributor Author

smith commented Sep 15, 2020

retest

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally and we're in good shape. Thanks for the Canvas changes, @smith. Let me know if you need help clearing up the CI issues.

`src` is incorrect, and will throw an error on startup.  The `scripts/storybook` script in `canvas` builds the addon.
@tylersmalley
Copy link
Contributor

Just a heads up, looks like this is going to block the Jest 26 upgrade. #78720

Let me know if there is anything you need to help get this over the finish line.

@smith
Copy link
Contributor Author

smith commented Sep 29, 2020

@tylersmalley

Just a heads up, looks like this is going to block the Jest 26 upgrade. #78720

How's it blocking? I'd be happy to go back and fix this once the upgrade is merged.

Let me know if there is anything you need to help get this over the finish line.

I haven't been able to get to it in the last few days, but the only failure was in the Canvas storyshots because it's relying on the DLL being built, so I'm going to figure out how best to fix that.

@tylersmalley
Copy link
Contributor

@smith,

Sorry, there might be some confusion. The upgrade to Storybook 6 is blocking upgrading to Jest 26. There was a breaking change in Jest 26 which Storyshots didn't resolve until 6.0. Details: storybookjs/storybook#10631

@smith
Copy link
Contributor Author

smith commented Sep 29, 2020

@tylersmalley oh ok that makes sense. @clintandrewhall do you think it would be ok to momentarily disable the storyshot test in canvas to get this and the jest upgrade merged?

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

@kbn/optimizer bundle module count

id value diff baseline
core 432 +2 430
ingestManager 542 +2 540
kibanaReact 291 +2 289
kibanaUtils 191 +2 189
ml 1185 +1 1184
security 456 +2 454
securitySolution 1972 +2 1970
total +13

async chunks size

id value diff baseline
core 155.4KB +2.5KB 152.8KB
enterpriseSearch 477.3KB +170.0B 477.1KB
ingestManager 1.1MB +2.5KB 1.1MB
kibanaReact 391.5KB +2.5KB 389.0KB
kibanaUtils 158.6KB +2.5KB 156.0KB
ml 10.5MB +2.5KB 10.5MB
security 1.0MB +2.5KB 1.0MB
securitySolution 10.2MB +2.5KB 10.2MB
total +17.8KB

distributable file count

id value diff baseline
default 45771 -51 45822
oss 26526 -46 26572

page load bundle size

id value diff baseline
upgradeAssistant 64.8KB +85.0B 64.7KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@smith smith merged commit 564a7b1 into elastic:master Sep 30, 2020
@smith smith deleted the nls/sb6 branch September 30, 2020 00:34
smith added a commit to smith/kibana that referenced this pull request Sep 30, 2020
Upgrade to Storybook 6 and attempt to use the declarative configuration.

The goals of this PR (as part of Kibana's Storybook roadmap, are:

Upgrade to Storybook 6
Still allow running Storybooks with yarn storybook plugin_name
Use the declarative configuration to (hopefully) make the configuration simpler to use an easier to understand, as well as avoiding deprecation warnings and loss of future compatibility
The ways in which what I have so far differs from how we do things today are:

In the alias configuration it takes a path to a storybook configuration directory instead of the storybook.js file from before
Each plugin (it doesn't have to be a plugin; can be any directory) has a .storybook/main.js (the aliases file in @kbn/storybook specifies these locations) where they can define their Storybook configuration. You can require('@kbn/storybook').defaultConfig to get defaults and override them
@kbn/storybook has a preset that can provide Webpack and Babel configuration and Storybook parameters and decorators
Instead of dynamically creating the list of stories to import, we define them in the globs of the stories property in .storybook/main.js.
Do not build a DLL. We are using @kbn/ui-shared-deps as externals. Startup time is not quite as fast but still acceptable.
Other things done in this PR:

Allow default exports in .stories. to allow for Common Story Format CSF stories
Add guard in Webpack configuration needed for overriding CSS rules
Update filename casing check to allow for files with required names in Storybook
Clean up observability stories
Rename *.examples.tsx and *.story.tsx to *.stories.tsx
smith added a commit to smith/kibana that referenced this pull request Sep 30, 2020
Upgrade to Storybook 6 and attempt to use the declarative configuration.

The goals of this PR (as part of Kibana's Storybook roadmap, are:

Upgrade to Storybook 6
Still allow running Storybooks with yarn storybook plugin_name
Use the declarative configuration to (hopefully) make the configuration simpler to use an easier to understand, as well as avoiding deprecation warnings and loss of future compatibility
The ways in which what I have so far differs from how we do things today are:

In the alias configuration it takes a path to a storybook configuration directory instead of the storybook.js file from before
Each plugin (it doesn't have to be a plugin; can be any directory) has a .storybook/main.js (the aliases file in @kbn/storybook specifies these locations) where they can define their Storybook configuration. You can require('@kbn/storybook').defaultConfig to get defaults and override them
@kbn/storybook has a preset that can provide Webpack and Babel configuration and Storybook parameters and decorators
Instead of dynamically creating the list of stories to import, we define them in the globs of the stories property in .storybook/main.js.
Do not build a DLL. We are using @kbn/ui-shared-deps as externals. Startup time is not quite as fast but still acceptable.
Other things done in this PR:

Allow default exports in .stories. to allow for Common Story Format CSF stories
Add guard in Webpack configuration needed for overriding CSS rules
Update filename casing check to allow for files with required names in Storybook
Clean up observability stories
Rename *.examples.tsx and *.story.tsx to *.stories.tsx
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 2, 2020
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

1 similar comment
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 5, 2020
smith added a commit that referenced this pull request Oct 5, 2020
Upgrade to Storybook 6 and attempt to use the declarative configuration.

The goals of this PR (as part of Kibana's Storybook roadmap, are:

Upgrade to Storybook 6
Still allow running Storybooks with yarn storybook plugin_name
Use the declarative configuration to (hopefully) make the configuration simpler to use an easier to understand, as well as avoiding deprecation warnings and loss of future compatibility
The ways in which what I have so far differs from how we do things today are:

In the alias configuration it takes a path to a storybook configuration directory instead of the storybook.js file from before
Each plugin (it doesn't have to be a plugin; can be any directory) has a .storybook/main.js (the aliases file in @kbn/storybook specifies these locations) where they can define their Storybook configuration. You can require('@kbn/storybook').defaultConfig to get defaults and override them
@kbn/storybook has a preset that can provide Webpack and Babel configuration and Storybook parameters and decorators
Instead of dynamically creating the list of stories to import, we define them in the globs of the stories property in .storybook/main.js.
Do not build a DLL. We are using @kbn/ui-shared-deps as externals. Startup time is not quite as fast but still acceptable.
Other things done in this PR:

Allow default exports in .stories. to allow for Common Story Format CSF stories
Add guard in Webpack configuration needed for overriding CSS rules
Update filename casing check to allow for files with required names in Storybook
Clean up observability stories
Rename *.examples.tsx and *.story.tsx to *.stories.tsx

* Storybook 6 and config changes (#75357)

Upgrade to Storybook 6 and attempt to use the declarative configuration.

The goals of this PR (as part of Kibana's Storybook roadmap, are:

Upgrade to Storybook 6
Still allow running Storybooks with yarn storybook plugin_name
Use the declarative configuration to (hopefully) make the configuration simpler to use an easier to understand, as well as avoiding deprecation warnings and loss of future compatibility
The ways in which what I have so far differs from how we do things today are:

In the alias configuration it takes a path to a storybook configuration directory instead of the storybook.js file from before
Each plugin (it doesn't have to be a plugin; can be any directory) has a .storybook/main.js (the aliases file in @kbn/storybook specifies these locations) where they can define their Storybook configuration. You can require('@kbn/storybook').defaultConfig to get defaults and override them
@kbn/storybook has a preset that can provide Webpack and Babel configuration and Storybook parameters and decorators
Instead of dynamically creating the list of stories to import, we define them in the globs of the stories property in .storybook/main.js.
Do not build a DLL. We are using @kbn/ui-shared-deps as externals. Startup time is not quite as fast but still acceptable.
Other things done in this PR:

Allow default exports in .stories. to allow for Common Story Format CSF stories
Add guard in Webpack configuration needed for overriding CSS rules
Update filename casing check to allow for files with required names in Storybook
Clean up observability stories
Rename *.examples.tsx and *.story.tsx to *.stories.tsx

Co-authored-by: Tyler Smalley <tyler.smalley@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Drilldowns Embeddable panel Drilldowns Feature:Embedding Embedding content via iFrame release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.