🔧(react) migrate storybook deployment to version 7

The package @storybook/storybook-deployer that seems to not directly work
with Storybook 7 was expecting that command named "build-storybook" to
exist. With the bin updates of Storybook 7 this bin does not longer exist,
so I created a specfic script inside package.json that is named
"build-storybook" too in order to make everything work. Also now that
Storybook uses directly the local vite config, the fact that our config
generates types was causing issues when building Storybook, that why
we filter plugins in main.ts in order to remove "vite:dts".
This commit is contained in:
Nathan Vasse
2023-05-12 16:58:51 +02:00
committed by NathanVss
parent 77721c3b6d
commit 424fa05cca
2 changed files with 14 additions and 0 deletions

View File

@@ -28,6 +28,19 @@ const config: StorybookConfig = {
features: {
storyStoreV7: true,
},
async viteFinal(config, options) {
// We don't want the Storybook build to generate type definitions.
const newConfig = {
...config,
plugins: config.plugins.filter((plugin) => {
if (typeof plugin === "object") {
return (plugin as any).name !== "vite:dts";
}
return true;
}),
};
return newConfig;
},
};
export default config;

View File

@@ -35,6 +35,7 @@
"test-watch": "vitest",
"coverage": "vitest run --coverage",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"deploy-storybook": "storybook-to-ghpages"
},
"dependencies": {