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

56 lines
1.5 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-03-11 08:15:19 +03:00
],
2023-02-14 06:18:43 +03:00
framework: {
name: '@storybook/react-vite',
},
async viteFinal(config, _) {
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)),
}),
],
define: {
'process.env': {},
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;