2024-02-09 15:40:26 +01:00
|
|
|
import { dirname, join, resolve } from 'node:path';
|
2024-02-08 10:43:55 +01:00
|
|
|
|
|
|
|
import type { StorybookConfig } from '@storybook/sveltekit';
|
|
|
|
import { mergeConfig } from 'vite';
|
|
|
|
|
|
|
|
const config: StorybookConfig = {
|
2024-02-09 15:40:26 +01:00
|
|
|
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.ts'],
|
2024-02-08 10:43:55 +01:00
|
|
|
addons: [
|
2024-02-17 23:50:27 +01:00
|
|
|
'@storybook/addon-a11y',
|
2024-02-08 10:43:55 +01:00
|
|
|
'@storybook/addon-essentials',
|
2024-02-17 23:50:27 +01:00
|
|
|
'@storybook/addon-links',
|
2024-02-09 21:13:06 +01:00
|
|
|
'@storybook/addon-interactions',
|
2024-02-17 23:50:27 +01:00
|
|
|
'@storybook/addon-toolbar'
|
2024-02-08 10:43:55 +01:00
|
|
|
],
|
|
|
|
core: {
|
2024-02-09 21:13:06 +01:00
|
|
|
disableTelemetry: true
|
2024-02-08 10:43:55 +01:00
|
|
|
},
|
|
|
|
framework: {
|
|
|
|
name: '@storybook/sveltekit',
|
|
|
|
options: {}
|
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
autodocs: 'tag'
|
|
|
|
},
|
|
|
|
async viteFinal(config) {
|
2024-02-09 15:40:26 +01:00
|
|
|
const allowFiles = config.server?.fs?.allow || [];
|
|
|
|
const storyFiles = resolve('stories');
|
|
|
|
|
2024-02-08 10:43:55 +01:00
|
|
|
return mergeConfig(config, {
|
2024-02-09 15:40:26 +01:00
|
|
|
alias: {
|
|
|
|
...config.alias,
|
|
|
|
$lib: resolve('..', 'src', 'lib')
|
|
|
|
},
|
2024-02-08 10:43:55 +01:00
|
|
|
server: {
|
|
|
|
...config.server,
|
|
|
|
fs: {
|
2024-02-08 10:56:03 +01:00
|
|
|
...config.server?.fs,
|
2024-02-09 15:40:26 +01:00
|
|
|
allow: [...allowFiles, storyFiles]
|
2024-02-08 10:43:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
export default config;
|