AFFiNE/apps/storybook/.storybook/main.ts

63 lines
1.8 KiB
TypeScript
Raw Normal View History

import { runCli } from '@magic-works/i18n-codegen';
2023-02-14 06:18:43 +03:00
import type { StorybookConfig } from '@storybook/react-vite';
import { fileURLToPath } from 'node:url';
import { mergeConfig } from 'vite';
2023-04-04 02:13:43 +03:00
import tsconfigPaths from 'vite-tsconfig-paths';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
2023-07-18 19:53:10 +03:00
import { getRuntimeConfig } from '../../core/.webpack/runtime-config';
2023-02-14 06:18:43 +03:00
runCli(
{
config: fileURLToPath(
new URL('../../../.i18n-codegen.json', import.meta.url)
),
watch: false,
},
error => {
console.error(error);
process.exit(1);
}
);
2023-02-14 06:18:43 +03:00
export default {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
2023-07-18 19:53:10 +03:00
staticDirs: ['../../../apps/core/public'],
2023-03-11 08:15:19 +03:00
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
2023-03-11 08:15:19 +03:00
'@storybook/addon-interactions',
'@storybook/addon-storysource',
'storybook-dark-mode',
2023-08-15 23:34:02 +03:00
'storybook-addon-react-router-v6',
2023-03-11 08:15:19 +03:00
],
2023-02-14 06:18:43 +03:00
framework: {
name: '@storybook/react-vite',
},
2023-08-23 17:50:25 +03:00
async viteFinal(config, _options) {
return mergeConfig(config, {
assetsInclude: ['**/*.md'],
2023-04-04 02:13:43 +03:00
plugins: [
vanillaExtractPlugin(),
2023-04-04 02:13:43 +03:00
tsconfigPaths({
root: fileURLToPath(new URL('../../../', import.meta.url)),
ignoreConfigErrors: true,
2023-04-04 02:13:43 +03:00
}),
],
define: {
'process.env': {},
'process.env.COVERAGE': JSON.stringify(!!process.env.COVERAGE),
'process.env.SHOULD_REPORT_TRACE': `${Boolean(
process.env.SHOULD_REPORT_TRACE
)}`,
'process.env.TRACE_REPORT_ENDPOINT': `"${process.env.TRACE_REPORT_ENDPOINT}"`,
2023-07-18 19:53:10 +03:00
runtimeConfig: getRuntimeConfig({
distribution: 'browser',
mode: 'development',
channel: 'canary',
coverage: false,
}),
},
});
2023-02-14 06:18:43 +03:00
},
} as StorybookConfig;