-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathmain.ts
55 lines (48 loc) · 1.4 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import type { StorybookConfig } from '@storybook/react-webpack5';
import { resolve, dirname, join } from 'path';
const config: StorybookConfig = {
stories: [
'../src/lib/**/*.@(mdx)',
'../src/lib/**/*.stories.@(js|jsx|ts|tsx|mdx)',
],
staticDirs: ['../src/static'],
addons: [
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@nx/react/plugins/storybook', ''),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-designs'),
],
framework: {
name: getAbsolutePath('@storybook/react-webpack5'),
options: {
builder: {},
},
},
docs: {},
typescript: {
reactDocgen: 'react-docgen-typescript',
},
webpackFinal(config) {
config.resolve = {
...config.resolve,
alias: {
'~styleguide/blocks': resolve(__dirname, './components/'),
'@codecademy/gamut-styles$': resolve(
__dirname,
'../../gamut-styles/src'
),
'@codecademy/gamut$': resolve(__dirname, '../../gamut/src'),
'@codecademy/gamut-illustrations$': resolve(
__dirname,
'../../gamut-illustrations/src'
),
'@codecademy/variance$': resolve(__dirname, '../../variance/src'),
},
};
return config;
},
};
export default config;
function getAbsolutePath(value: string, root = 'package.json'): string {
return dirname(require.resolve(join(value, root)));
}