2023-05-04 08:35:09 +03:00
|
|
|
import { runCli } from '@magic-works/i18n-codegen';
|
2023-02-14 06:18:43 +03:00
|
|
|
import type { StorybookConfig } from '@storybook/react-vite';
|
2023-04-04 00:18:46 +03:00
|
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
import { mergeConfig } from 'vite';
|
2023-04-04 02:13:43 +03:00
|
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
2023-04-04 20:46:33 +03:00
|
|
|
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
|
|
|
|
2023-05-04 08:35:09 +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',
|
2023-04-04 02:42:36 +03:00
|
|
|
'@storybook/addon-essentials',
|
2023-03-11 08:15:19 +03:00
|
|
|
'@storybook/addon-interactions',
|
2023-04-04 02:42:36 +03:00
|
|
|
'@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-04-04 00:18:46 +03:00
|
|
|
},
|
2023-08-23 17:50:25 +03:00
|
|
|
async viteFinal(config, _options) {
|
2023-04-04 00:18:46 +03:00
|
|
|
return mergeConfig(config, {
|
2023-04-25 09:58:30 +03:00
|
|
|
assetsInclude: ['**/*.md'],
|
2023-04-04 02:13:43 +03:00
|
|
|
plugins: [
|
2023-04-04 20:46:33 +03:00
|
|
|
vanillaExtractPlugin(),
|
2023-04-04 02:13:43 +03:00
|
|
|
tsconfigPaths({
|
|
|
|
root: fileURLToPath(new URL('../../../', import.meta.url)),
|
2023-08-29 13:07:05 +03:00
|
|
|
ignoreConfigErrors: true,
|
2023-04-04 02:13:43 +03:00
|
|
|
}),
|
|
|
|
],
|
2023-04-04 00:18:46 +03:00
|
|
|
define: {
|
|
|
|
'process.env': {},
|
2023-08-29 13:07:05 +03:00
|
|
|
'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-04-04 00:18:46 +03:00
|
|
|
},
|
|
|
|
});
|
2023-02-14 06:18:43 +03:00
|
|
|
},
|
|
|
|
} as StorybookConfig;
|