-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Expand file tree
/
Copy pathpreset.ts
More file actions
23 lines (19 loc) · 829 Bytes
/
preset.ts
File metadata and controls
23 lines (19 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { dirname, join } from 'path';
import type { PresetProperty } from '@storybook/types';
import type { StorybookConfig } from './types';
const getAbsolutePath = <I extends string>(input: I): I =>
dirname(require.resolve(join(input, 'package.json'))) as any;
export const addons: PresetProperty<'addons', StorybookConfig> = [
getAbsolutePath('@storybook/preset-svelte-webpack'),
];
export const core: PresetProperty<'core', StorybookConfig> = async (config, options) => {
const framework = await options.presets.apply<StorybookConfig['framework']>('framework');
return {
...config,
builder: {
name: getAbsolutePath('@storybook/builder-webpack5'),
options: typeof framework === 'string' ? {} : framework.options.builder || {},
},
renderer: getAbsolutePath('@storybook/svelte'),
};
};