@repodog/storybook-config 0.0.4 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/index.mjs +30 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,10 +47,13 @@ module.exports = {
|
|
|
47
47
|
```typescript
|
|
48
48
|
// .storybook/main.ts
|
|
49
49
|
import { config as storybookConfig } from '@repodog/storybook-config';
|
|
50
|
+
import swcConfig from '@repodog/swc-config';
|
|
50
51
|
import { type StorybookConfig } from '@storybook/your-framework';
|
|
51
52
|
|
|
52
53
|
const config: StorybookConfig = {
|
|
53
|
-
...storybookConfig({ compiler: 'swc' })
|
|
54
|
+
...storybookConfig({ compiler: ['swc', swcConfig.ts] })
|
|
55
|
+
// or
|
|
56
|
+
...storybookConfig({ compiler: ['swc', swcConfig.js] })
|
|
54
57
|
};
|
|
55
58
|
|
|
56
59
|
export default config;
|
|
@@ -64,7 +67,7 @@ import { config as storybookConfig } from '@repodog/storybook-config';
|
|
|
64
67
|
import { type StorybookConfig } from '@storybook/your-framework';
|
|
65
68
|
|
|
66
69
|
const config: StorybookConfig = {
|
|
67
|
-
...storybookConfig(
|
|
70
|
+
...storybookConfig()
|
|
68
71
|
};
|
|
69
72
|
|
|
70
73
|
export default config;
|
package/index.mjs
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
export const config = ({ compiler } = {}) =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
export const config = ({ compiler = [] } = {}) => {
|
|
2
|
+
const [name, options = {}] = Array.isArray(compiler) ? compiler : [compiler];
|
|
3
|
+
const isCompilerSwc = name === 'swc';
|
|
4
|
+
|
|
5
|
+
return {
|
|
6
|
+
addons: [
|
|
7
|
+
'@storybook/addon-links',
|
|
8
|
+
'@storybook/addon-essentials',
|
|
9
|
+
'@storybook/addon-onboarding',
|
|
10
|
+
'@storybook/addon-a11y',
|
|
11
|
+
'@storybook/addon-interactions',
|
|
12
|
+
],
|
|
13
|
+
docs: {
|
|
14
|
+
autodocs: 'tag',
|
|
15
|
+
},
|
|
16
|
+
framework: {
|
|
17
|
+
name: '@storybook/nextjs',
|
|
18
|
+
...(isCompilerSwc
|
|
19
|
+
? {
|
|
20
|
+
options: {
|
|
21
|
+
builder: {
|
|
22
|
+
useSWC: true,
|
|
23
|
+
},
|
|
19
24
|
},
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
|
+
: {}),
|
|
27
|
+
},
|
|
28
|
+
stories: ['../**/*.stories.*'],
|
|
29
|
+
...(isCompilerSwc ? { swc: () => options } : {}),
|
|
30
|
+
};
|
|
31
|
+
};
|
package/package.json
CHANGED