[8.11] Remove CI Composite Storybook (#171258) (#171695)

# Backport

This will backport the following commits from `main` to `8.11`:
- [Remove CI Composite Storybook
(#171258)](https://github.com/elastic/kibana/pull/171258)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Brad
White","email":"Ikuni17@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-11-21T21:59:39Z","message":"Remove
CI Composite Storybook (#171258)\n\n## Summary\r\nCloses
#160803\r\n\r\nThis PR removes the `CI Composite` story because it has
been broken\r\nsince at least ac23dce29f
(and possibly\r\nsince b862a6c181). The
functionality is\r\ncovered by the generated `index.html`
in\r\ndda4498fee/.buildkite/scripts/steps/storybooks/build_and_upload.ts (L105-L120)\r\n\r\nTo
fix the composite story requires generating `stories.json` for
every\r\nstorybook, which requires migrating the repo off the
deprecated\r\n`storiesOf` API. That task is quite extensive and would be
better\r\nhandled alongside an upgrade to Storybook
7.x","sha":"1919c87b90c4f489c2027d71293631d89034f40f","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","ci:build-storybooks","v8.12.0"],"number":171258,"url":"https://github.com/elastic/kibana/pull/171258","mergeCommit":{"message":"Remove
CI Composite Storybook (#171258)\n\n## Summary\r\nCloses
#160803\r\n\r\nThis PR removes the `CI Composite` story because it has
been broken\r\nsince at least ac23dce29f
(and possibly\r\nsince b862a6c181). The
functionality is\r\ncovered by the generated `index.html`
in\r\ndda4498fee/.buildkite/scripts/steps/storybooks/build_and_upload.ts (L105-L120)\r\n\r\nTo
fix the composite story requires generating `stories.json` for
every\r\nstorybook, which requires migrating the repo off the
deprecated\r\n`storiesOf` API. That task is quite extensive and would be
better\r\nhandled alongside an upgrade to Storybook
7.x","sha":"1919c87b90c4f489c2027d71293631d89034f40f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/171258","number":171258,"mergeCommit":{"message":"Remove
CI Composite Storybook (#171258)\n\n## Summary\r\nCloses
#160803\r\n\r\nThis PR removes the `CI Composite` story because it has
been broken\r\nsince at least ac23dce29f
(and possibly\r\nsince b862a6c181). The
functionality is\r\ncovered by the generated `index.html`
in\r\ndda4498fee/.buildkite/scripts/steps/storybooks/build_and_upload.ts (L105-L120)\r\n\r\nTo
fix the composite story requires generating `stories.json` for
every\r\nstorybook, which requires migrating the repo off the
deprecated\r\n`storiesOf` API. That task is quite extensive and would be
better\r\nhandled alongside an upgrade to Storybook
7.x","sha":"1919c87b90c4f489c2027d71293631d89034f40f"}}]}] BACKPORT-->

Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-11-22 20:28:29 -05:00 committed by GitHub
parent 268df575fd
commit afc09dd591
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 41 deletions

View file

@ -16,7 +16,6 @@ const STORYBOOKS = [
'canvas',
'cases',
'cell_actions',
'ci_composite',
'cloud_chat',
'coloring',
'chart_icons',
@ -93,14 +92,12 @@ const upload = () => {
console.log('--- Generating Storybooks HTML');
process.chdir(path.join('.', 'built_assets', 'storybook'));
fs.renameSync('ci_composite', 'composite');
const storybooks = execSync(`ls -1d */`)
.toString()
.trim()
.split('\n')
.map((filePath) => filePath.replace('/', ''))
.filter((filePath) => filePath !== 'composite');
.map((filePath) => filePath.replace('/', ''));
const listHtml = storybooks
.map((storybook) => `<li><a href="${STORYBOOK_BASE_URL}/${storybook}">${storybook}</a></li>`)
@ -110,8 +107,6 @@ const upload = () => {
<html>
<body>
<h1>Storybooks</h1>
<p><a href="${STORYBOOK_BASE_URL}/composite">Composite Storybook</a></p>
<h2>All</h2>
<ul>
${listHtml}
</ul>

View file

@ -1,34 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
const config = require('@kbn/storybook').defaultConfig;
const aliases = require('../../src/dev/storybook/aliases').storybookAliases;
config.refs = {};
// Required due to https://github.com/storybookjs/storybook/issues/13834
config.babel = async (options) => ({
...options,
plugins: ['@babel/plugin-transform-typescript', ...options.plugins],
});
for (const alias of Object.keys(aliases).filter((a) => a !== 'ci_composite')) {
// snake_case -> Title Case
const title = alias
.replace(/_/g, ' ')
.split(' ')
.map((n) => n[0].toUpperCase() + n.slice(1))
.join(' ');
config.refs[alias] = {
title: title,
url: `${process.env.STORYBOOK_BASE_URL}/${alias}`,
};
}
module.exports = config;

View file

@ -15,7 +15,6 @@ export const storybookAliases = {
canvas: 'x-pack/plugins/canvas/storybook',
cases: 'packages/kbn-cases-components/.storybook',
cell_actions: 'packages/kbn-cell-actions/.storybook',
ci_composite: '.ci/.storybook',
cloud_chat: 'x-pack/plugins/cloud_integrations/cloud_chat/.storybook',
coloring: 'packages/kbn-coloring/.storybook',
language_documentation_popover: 'packages/kbn-language-documentation-popover/.storybook',