mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-03 07:14:38 +03:00
6683ffb890
In this PR, I'm simplifying storybook setup: 1) Remove build --test configuration that prevent autodocs. We are not using autodocs at all (the dev experience is not good enough), so I have completely disabled it. 2) Clarify `serve` vs `test` vs `serve-and-test` configurations After this PR: - you can serve storybook in two modes: `npx nx run twenty-front:storybook:serve:dev` and `npx nx run twenty-front:storybook:serve:static` - you can run tests agains an already served storybook (this is useful in dev so you don't have to rebuild everytime to run tests): `npx nx run twenty-front:storybook:test` - you can conbine both: `npx nx run twenty-front:storybook:serve-and-test:static`
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { StorybookConfig } from '@storybook/react-vite';
|
|
|
|
const computeStoriesGlob = () => {
|
|
if (process.env.STORYBOOK_SCOPE === 'pages') {
|
|
return [
|
|
'../src/pages/**/*.stories.@(js|jsx|ts|tsx)',
|
|
'../src/__stories__/*.stories.@(js|jsx|ts|tsx)',
|
|
'../src/pages/**/*.docs.mdx',
|
|
'../src/__stories__/*.docs.mdx',
|
|
];
|
|
}
|
|
|
|
if (process.env.STORYBOOK_SCOPE === 'modules') {
|
|
return [
|
|
'../src/modules/**/!(perf)/*.stories.@(js|jsx|ts|tsx)',
|
|
'../src/modules/**/*.docs.mdx',
|
|
];
|
|
}
|
|
|
|
if (process.env.STORYBOOK_SCOPE === 'performance') {
|
|
return ['../src/modules/**/perf/*.perf.stories.@(js|jsx|ts|tsx)'];
|
|
}
|
|
|
|
if (process.env.STORYBOOK_SCOPE === 'ui-docs') {
|
|
return ['../src/modules/ui/**/*.docs.mdx'];
|
|
}
|
|
|
|
return ['../src/**/*.docs.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'];
|
|
};
|
|
|
|
const config: StorybookConfig = {
|
|
stories: computeStoriesGlob(),
|
|
staticDirs: ['../public'],
|
|
addons: [
|
|
'@storybook/addon-links',
|
|
'@storybook/addon-essentials',
|
|
'@storybook/addon-onboarding',
|
|
'@storybook/addon-interactions',
|
|
'@storybook/addon-coverage',
|
|
'storybook-dark-mode',
|
|
'storybook-addon-cookie',
|
|
'storybook-addon-pseudo-states',
|
|
],
|
|
framework: {
|
|
name: '@storybook/react-vite',
|
|
options: {},
|
|
},
|
|
};
|
|
export default config;
|