Migrate to a monorepo structure (#2909)
This commit is contained in:
45
packages/twenty-front/.storybook/main.ts
Normal file
45
packages/twenty-front/.storybook/main.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import type { 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/**/*.stories.@(js|jsx|ts|tsx)', '../src/modules/**/*.docs.mdx']
|
||||
}
|
||||
|
||||
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/addon-themes',
|
||||
'storybook-addon-cookie',
|
||||
'storybook-addon-pseudo-states',
|
||||
],
|
||||
framework: {
|
||||
name: '@storybook/react-vite',
|
||||
options: {},
|
||||
},
|
||||
docs: {
|
||||
autodocs: false,
|
||||
},
|
||||
};
|
||||
export default config;
|
||||
37
packages/twenty-front/.storybook/preview-head.html
Normal file
37
packages/twenty-front/.storybook/preview-head.html
Normal file
@ -0,0 +1,37 @@
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.7/iframeResizer.contentWindow.min.js"></script>
|
||||
<!-- <script>
|
||||
window.global = window;
|
||||
</script> -->
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
html {
|
||||
font-size: 13px;
|
||||
}
|
||||
.sbdocs-wrapper {
|
||||
padding: 0 !important;
|
||||
}
|
||||
*::-webkit-scrollbar {
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-corner {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-thumb {
|
||||
background-color: transparent;
|
||||
border-radius: 2px;
|
||||
}
|
||||
</style>
|
||||
46
packages/twenty-front/.storybook/preview.ts
Normal file
46
packages/twenty-front/.storybook/preview.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import { ThemeProvider } from '@emotion/react';
|
||||
import { Preview, ReactRenderer } from '@storybook/react';
|
||||
import { withThemeFromJSXProvider } from "@storybook/addon-themes";
|
||||
import { initialize, mswLoader } from 'msw-storybook-addon';
|
||||
|
||||
import { RootDecorator } from '../src/testing/decorators/RootDecorator';
|
||||
import { mockedUserJWT } from '../src/testing/mock-data/jwt';
|
||||
|
||||
import { lightTheme, darkTheme } from '../src/modules/ui/theme/constants/theme';
|
||||
import 'react-loading-skeleton/dist/skeleton.css';
|
||||
|
||||
initialize({ onUnhandledRequest: 'bypass' });
|
||||
|
||||
const preview: Preview = {
|
||||
decorators: [
|
||||
withThemeFromJSXProvider<ReactRenderer>({
|
||||
themes: {
|
||||
light: lightTheme,
|
||||
dark: darkTheme,
|
||||
},
|
||||
defaultTheme: 'light',
|
||||
Provider: ThemeProvider,
|
||||
}),
|
||||
RootDecorator,
|
||||
],
|
||||
parameters: {
|
||||
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
options: {
|
||||
storySort: {
|
||||
order: ['UI', 'Modules', 'Pages'],
|
||||
},
|
||||
},
|
||||
cookie: {
|
||||
tokenPair: `{%22accessToken%22:{%22token%22:%22${mockedUserJWT}%22%2C%22expiresAt%22:%222023-07-18T15:06:40.704Z%22%2C%22__typename%22:%22AuthToken%22}%2C%22refreshToken%22:{%22token%22:%22${mockedUserJWT}%22%2C%22expiresAt%22:%222023-10-15T15:06:41.558Z%22%2C%22__typename%22:%22AuthToken%22}%2C%22__typename%22:%22AuthTokenPair%22}`,
|
||||
},
|
||||
loaders: [mswLoader],
|
||||
},
|
||||
};
|
||||
|
||||
export default preview;
|
||||
13
packages/twenty-front/.storybook/test-runner-jest.config.js
Normal file
13
packages/twenty-front/.storybook/test-runner-jest.config.js
Normal file
@ -0,0 +1,13 @@
|
||||
import { getJestConfig } from "@storybook/test-runner";
|
||||
|
||||
/**
|
||||
* @type {import('@jest/types').Config.InitialOptions}
|
||||
*/
|
||||
export default {
|
||||
// The default configuration comes from @storybook/test-runner
|
||||
...getJestConfig(),
|
||||
/** Add your own overrides below
|
||||
* @see https://jestjs.io/docs/configuration
|
||||
*/
|
||||
testTimeout: process.env.STORYBOOK_SCOPE === 'pages' ? 60000 : 15000,
|
||||
};
|
||||
Reference in New Issue
Block a user