|
| 1 | +import type { StorybookConfig } from "@storybook/react-webpack5"; |
| 2 | + |
1 | 3 | /* globals __dirname:false */
|
2 | 4 | const path = require("path");
|
3 | 5 | const glob = require("glob");
|
4 | 6 | const ROOT = path.resolve(__dirname, "..");
|
5 | 7 | const PKGS = path.resolve(ROOT, "packages");
|
6 | 8 | const STORIES = path.resolve(ROOT, "stories");
|
7 | 9 |
|
8 |
| -const wrapForPnp = (packageName) => path.dirname(require.resolve(path.join(packageName, 'package.json'))); |
| 10 | +const wrapForPnp = (packageName) => |
| 11 | + path.dirname(require.resolve(path.join(packageName, "package.json"))); |
9 | 12 |
|
10 |
| -module.exports = { |
| 13 | +const config: StorybookConfig = { |
11 | 14 | webpackFinal: async (config) => {
|
12 | 15 | // Read all the victory packages and alias.
|
13 |
| - glob |
14 |
| - .sync(path.join(PKGS, "victory*/package.json")) |
15 |
| - .forEach((pkgPath) => { |
16 |
| - const key = path.dirname(path.relative(PKGS, pkgPath)); |
| 16 | + glob.sync(path.join(PKGS, "victory*/package.json")).forEach((pkgPath) => { |
| 17 | + const key = path.dirname(path.relative(PKGS, pkgPath)); |
| 18 | + if (config?.resolve?.alias) { |
17 | 19 | config.resolve.alias[key] = path.resolve(path.dirname(pkgPath));
|
18 |
| - }); |
| 20 | + } |
| 21 | + }); |
19 | 22 |
|
20 | 23 | return config;
|
21 | 24 | },
|
22 | 25 |
|
23 | 26 | addons: [
|
24 |
| - "@storybook/addon-options/register", |
| 27 | + "@storybook/addon-essentials", |
25 | 28 | {
|
26 | 29 | name: "@storybook/addon-storysource",
|
27 | 30 | options: {
|
@@ -49,4 +52,18 @@ module.exports = {
|
49 | 52 | },
|
50 | 53 | },
|
51 | 54 | },
|
| 55 | + |
| 56 | + typescript: { |
| 57 | + // typescript compilation check is disabled until we upgrade the babel version |
| 58 | + // which is required for the latest version of storybook to do typechecking |
| 59 | + // https://github.com/FormidableLabs/victory/issues/2746 |
| 60 | + check: false, |
| 61 | + checkOptions: { |
| 62 | + typescript: { |
| 63 | + configFile: path.join(__dirname, "../tsconfig.base.json"), |
| 64 | + }, |
| 65 | + }, |
| 66 | + }, |
52 | 67 | };
|
| 68 | + |
| 69 | +export default config; |
0 commit comments