## Summary
Depends on elastic#191106
Closes elastic#171591
This PR migrates Storybook from `6.x` to `8.x`. Please see the
[migration
guide](https://storybook.js.org/docs/migration-guide/from-older-version)
for an overview of the changes because there are many breaking changes
which effect Kibana. The TODO list below is not inclusive of all the
changes.
## Reviewers
### Each commit contains all files changed for a specific codeowner,
please find your respective commit to make review easier.
A **first step before code review** should be checking the [`Storybooks
Preview`](https://ci-artifacts.kibana.dev/storybooks/pr-195148/index.html)
from CI for any runtime or style issues which were missed. The preview
can be compared to a build from `main`
[here](https://ci-artifacts.kibana.dev/storybooks/pr-212585/index.html).
It is worth noting that some stories have runtime issues which existed
before this migration.
Most stories appear to have been migrated properly, but the Operations
team does not have prior knowledge into every story. Some of the
migration was able to be automated through Storybook provided scripts.
It is possible this wasn't entirely correct due to the structure of some
stories. Additionally, part of this migration is moving Storybook to
Webpack 5 which changed how styles are being loaded.
#### TODO
- [x] Migrate `stories.mdx`
- [x] storyshots
- [x] [Migrate
packages](https://storybook.js.org/docs/migration-guide/from-older-version#package-structure-changes)
which were removed in `8.0`
- [x] `react-doc-gen` resolution
- [x] [Migrate
blocks](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#addon-docs-removed-deprecated-blocksjs-entry)
- [x] Migrate deprecated `addon-knobs` to
[addon-controls](https://www.npmjs.com/package/@storybook/addon-controls)
- [x] React Fast Refresh support
- [x] Watch flag callback
- [x] `canvas` webpack
- [x] Rerun CSF migrations for new stories
- [x] Handle ESM import for `addon-docs`
- [x] `'@storybook/addon-actions' should be listed in the project's
dependencies. Run 'npm i -S @storybook/addon-actions' to add
iteslint[import/no-extraneous-dependencies](https://github.com/import-js/eslint-plugin-import/blob/v2.28.0/docs/rules/no-extraneous-dependencies.md)`
- [x] `addDecorator` migration
- [x] `addParameter` migration
- [x] static build
- [ ] determine if elastic#176500 is solved or push to followup PR
- This will need to be fixed separately
- [x] revert `.buildkite/pipelines/pull_request/base.yml` &
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to `main`
---------
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jacek Kolezynski <jacek.kolezynski@elastic.co>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
(cherry picked from commit 403b5f2)
# Conflicts:
# package.json
# src/dev/storybook/aliases.ts
# src/platform/packages/shared/kbn-ambient-storybook-types/index.d.ts
# src/platform/packages/shared/kbn-monaco/src/painless/constants.ts
# src/platform/packages/shared/kbn-unified-tabs/src/components/__stories__/storybook_constants.ts
# src/platform/packages/shared/kbn-unified-tabs/src/components/__stories__/tab.stories.tsx
# src/platform/packages/shared/kbn-unified-tabs/src/components/__stories__/tabs.stories.tsx
# src/platform/packages/shared/shared-ux/chrome/navigation/src/ui/navigation.stories.tsx
# src/platform/plugins/shared/discover/.storybook/main.ts
# src/platform/plugins/shared/expression_image/public/expression_renderers/__stories__/image_renderer.stories.tsx
# src/platform/plugins/shared/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx
# src/platform/plugins/shared/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx
# x-pack/platform/plugins/private/canvas/public/components/custom_element_modal/__stories__/custom_element_modal.stories.tsx
# x-pack/platform/plugins/private/canvas/public/components/element_card/__stories__/element_card.stories.tsx
# x-pack/platform/plugins/private/canvas/public/components/workpad_header/editor_menu/__stories__/editor_menu.stories.tsx
# x-pack/platform/plugins/shared/triggers_actions_ui/.storybook/context/http.ts
# x-pack/solutions/observability/plugins/apm/public/components/app/service_map/__stories__/cytoscape_example_data.stories.tsx
# x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/asset_criticality_file_uploader.stories.tsx
# yarn.lock
Summary
Depends on #191106
Closes #171591
This PR migrates Storybook from
6.xto8.x. Please see the migration guide for an overview of the changes because there are many breaking changes which effect Kibana. The TODO list below is not inclusive of all the changes.Reviewers
Each commit contains all files changed for a specific codeowner, please find your respective commit to make review easier.
A first step before code review should be checking the
Storybooks Previewfrom CI for any runtime or style issues which were missed. The preview can be compared to a build frommainhere. It is worth noting that some stories have runtime issues which existed before this migration.Most stories appear to have been migrated properly, but the Operations team does not have prior knowledge into every story. Some of the migration was able to be automated through Storybook provided scripts. It is possible this wasn't entirely correct due to the structure of some stories. Additionally, part of this migration is moving Storybook to Webpack 5 which changed how styles are being loaded.
TODO
stories.mdx8.0react-doc-genresolutionaddon-knobsto addon-controlscanvaswebpackaddon-docs'@storybook/addon-actions' should be listed in the project's dependencies. Run 'npm i -S @storybook/addon-actions' to add iteslint[import/no-extraneous-dependencies](https://github.com/import-js/eslint-plugin-import/blob/v2.28.0/docs/rules/no-extraneous-dependencies.md)addDecoratormigrationaddParametermigration.buildkite/pipelines/pull_request/base.yml&.buildkite/scripts/pipelines/pull_request/pipeline.tstomain