[packages] Kill Storybook bloat; remove stories from BAZEL build (#135595)

This commit is contained in:
Clint Andrew Hall 2022-07-04 20:10:26 -05:00 committed by GitHub
parent b52ff2a10d
commit 742ef3e402
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 22 additions and 29 deletions

View file

@ -14,7 +14,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.story.*",
"**/*.stories.*",
],
)

View file

@ -15,6 +15,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.stories.*",
],
)
@ -61,7 +62,6 @@ RUNTIME_DEPS = [
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@storybook/addon-actions",
"@npm//@types/classnames",
"@npm//@types/enzyme",
"@npm//@types/jest",

View file

@ -15,6 +15,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.stories.*",
],
)
@ -43,7 +44,6 @@ RUNTIME_DEPS = [
"@npm//@elastic/eui",
"@npm//@emotion/css",
"@npm//@emotion/react",
"@npm//@storybook/addon-actions",
"@npm//classnames",
"@npm//enzyme",
"@npm//react-use",
@ -67,7 +67,6 @@ TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@emotion/css",
"@npm//@emotion/react",
"@npm//@storybook/addon-actions",
"@npm//@types/classnames",
"@npm//@types/enzyme",
"@npm//@types/jest",

View file

@ -14,6 +14,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.stories.*",
],
)
@ -56,7 +57,6 @@ RUNTIME_DEPS = [
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@storybook/addon-actions",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/react",

View file

@ -14,6 +14,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.stories.*",
],
)
@ -40,7 +41,6 @@ NPM_MODULE_EXTRA_FILES = [
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"@npm//@elastic/eui",
"@npm//@storybook/addon-actions",
"@npm//enzyme",
"@npm//react",
"//packages/kbn-i18n-react",
@ -59,7 +59,6 @@ RUNTIME_DEPS = [
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@storybook/addon-actions",
"@npm//@types/enzyme",
"@npm//@types/jest",
"@npm//@types/node",

View file

@ -6,7 +6,6 @@
* Side Public License, v 1.
*/
import { action } from '@storybook/addon-actions';
import {
getRedirectAppLinksMockServices,
getRedirectAppLinksStoryArgTypes,
@ -19,13 +18,14 @@ import { NoDataCardServices } from './services';
* Parameters drawn from the Storybook arguments collection that customize a component story.
*/
export type Params = Record<keyof ReturnType<typeof getStoryArgTypes>, any>;
type ActionFn = (name: string) => any;
/**
* Returns Storybook-compatible service abstractions for the `NoDataCard` Provider.
*/
export const getStoryServices = (params: Params) => {
export const getStoryServices = (params: Params, action: ActionFn = () => {}) => {
const services: NoDataCardServices = {
...getRedirectAppLinksStoryServices(),
...getRedirectAppLinksStoryServices(action),
...params,
addBasePath: (path) => {
action('addBasePath')(path);

View file

@ -7,6 +7,7 @@
*/
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Params, getStoryArgTypes, getStoryServices } from './mocks';
@ -30,7 +31,7 @@ const argTypes = getStoryArgTypes();
export const NoDataCard = (params: Params) => {
return (
<NoDataCardProvider {...getStoryServices(params)}>
<NoDataCardProvider {...getStoryServices(params, action)}>
<ConnectedComponent {...params} />
</NoDataCardProvider>
);

View file

@ -13,6 +13,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.stories.*",
],
)
@ -39,7 +40,6 @@ NPM_MODULE_EXTRA_FILES = [
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"@npm//@elastic/eui",
"@npm//@storybook/addon-actions",
"@npm//react-use",
"@npm//react",
"@npm//rxjs",
@ -57,7 +57,6 @@ RUNTIME_DEPS = [
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@storybook/addon-actions",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/react",

View file

@ -6,8 +6,6 @@
* Side Public License, v 1.
*/
import { action } from '@storybook/addon-actions';
import { Services } from './services';
/**
@ -15,10 +13,12 @@ import { Services } from './services';
*/
export type Params = Record<keyof ReturnType<typeof getStoryArgTypes>, any>;
type ActionFn = (name: string) => any;
/**
* Returns Storybook-compatible service abstractions for the `NoDataCard` Provider.
*/
export const getStoryServices = () => {
export const getStoryServices = (action: ActionFn = () => {}) => {
const services: Services = {
navigateToUrl: action('navigateToUrl'),
currentAppId: 'currentAppId',

View file

@ -6,10 +6,10 @@
* Side Public License, v 1.
*/
import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import React from 'react';
import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { action } from '@storybook/addon-actions';
import { RedirectAppLinks as Component } from '.';
import { getStoryArgTypes, getStoryServices } from './mocks';
import mdx from '../README.mdx';
@ -28,7 +28,7 @@ export default {
export const RedirectAppLinks = () => {
return (
<>
<Component {...getStoryServices()}>
<Component {...getStoryServices(action)}>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiButton

View file

@ -13,6 +13,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.stories.*",
],
)
@ -41,12 +42,10 @@ RUNTIME_DEPS = [
"@npm//@elastic/eui",
"@npm//@emotion/css",
"@npm//@emotion/react",
"@npm//@storybook/addon-actions",
"@npm//react",
"//packages/kbn-i18n",
"//packages/kbn-shared-ux-components",
"//packages/kbn-shared-ux-services",
"//packages/kbn-shared-ux-storybook",
"//packages/shared-ux/prompt/no_data_views",
]
@ -63,7 +62,6 @@ TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@emotion/css",
"@npm//@emotion/react",
"@npm//@storybook/addon-actions",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/react",
@ -71,7 +69,6 @@ TYPES_DEPS = [
"//packages/kbn-i18n:npm_module_types",
"//packages/kbn-shared-ux-components:npm_module_types",
"//packages/kbn-shared-ux-services:npm_module_types",
"//packages/kbn-shared-ux-storybook:npm_module_types",
"//packages/shared-ux/prompt/no_data_views:npm_module_types",
]

View file

@ -14,6 +14,7 @@ SOURCE_FILES = glob(
],
exclude = [
"**/*.test.*",
"**/*.stories.*",
],
)
@ -42,7 +43,6 @@ RUNTIME_DEPS = [
"@npm//@elastic/eui",
"@npm//@emotion/css",
"@npm//@emotion/react",
"@npm//@storybook/addon-actions",
"@npm//enzyme",
"@npm//react",
"//packages/kbn-i18n-react",
@ -64,7 +64,6 @@ TYPES_DEPS = [
"@npm//@elastic/eui",
"@npm//@emotion/css",
"@npm//@emotion/react",
"@npm//@storybook/addon-actions",
"@npm//@types/enzyme",
"@npm//@types/jest",
"@npm//@types/node",

View file

@ -6,13 +6,12 @@
* Side Public License, v 1.
*/
import { action } from '@storybook/addon-actions';
import { NoDataViewsPromptServices } from './services';
export type Params = Record<keyof ReturnType<typeof getStoryArgTypes>, any>;
type ActionFn = (name: string) => any;
export const getStoryServices = (params: Params) => {
export const getStoryServices = (params: Params, action: ActionFn = () => {}) => {
const services: NoDataViewsPromptServices = {
...params,
openDataViewEditor: (options) => {

View file

@ -29,7 +29,7 @@ export default {
export const NoDataViews = (params: Params) => {
return (
<NoDataViewsPromptProvider {...getStoryServices(params)}>
<NoDataViewsPromptProvider {...getStoryServices(params, action)}>
<NoDataViewsPrompt onDataViewCreated={action('onDataViewCreated')} />
</NoDataViewsPromptProvider>
);