Anvil/.storybook/main.ts
André Jaenisch be727a6d9c
chore: update dependencies
Turns out most Storybook Addons expect React and won't be installable in
a Svelte(Kit) project. But I could figure out how to use the play
functions. So I have an example for it.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
2024-07-30 12:55:35 +02:00

58 lines
1.8 KiB
TypeScript

/* Configuration of Storybook.
* Copyright (C) 2024 André Jaenisch
* SPDX-FileCopyrightText: 2024 André Jaenisch
* SPDX-License-Identifier: AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { dirname, join, resolve } from 'node:path';
import type { StorybookConfig } from '@storybook/sveltekit';
import { mergeConfig } from 'vite';
const config: StorybookConfig = {
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.ts'],
addons: [
'@storybook/addon-a11y',
'@storybook/addon-coverage',
'@storybook/addon-essentials',
'@storybook/addon-links',
'@storybook/addon-interactions',
'@storybook/addon-toolbar',
'@storybook/test'
],
core: {
disableTelemetry: true
},
framework: {
name: '@storybook/sveltekit',
options: {}
},
docs: {
autodocs: 'tag'
},
async viteFinal(config) {
const allowFiles = config.server?.fs?.allow || [];
const storyFiles = resolve('stories');
return mergeConfig(config, {
alias: {
...config.alias,
$lib: resolve('..', 'src', 'lib')
},
server: {
...config.server,
fs: {
...config.server?.fs,
allow: [...allowFiles, storyFiles]
}
}
});
}
};
export default config;