-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathmain.ts
40 lines (38 loc) · 1.26 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { StorybookConfig } from '@storybook/react-vite';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { join, dirname } from 'path';
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')));
}
const config: StorybookConfig = {
stories: [
'../packages/**/*.@(mdx)',
'../packages/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
addons: [
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-interactions'),
{
name: getAbsolutePath('@storybook/addon-storysource'),
options: {
loaderOptions: {
injectStoryParameters: false,
},
},
},
],
framework: {
name: getAbsolutePath('@storybook/react-vite'),
options: {},
},
staticDirs: ['./public'],
managerHead: head =>
`${head}<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico">`,
};
export default config;