🔧(deps) upgrade Storybook configuration files

This upgrade requires to update the configuration files.
This commit is contained in:
Nathan Vasse
2024-03-14 17:14:30 +01:00
committed by NathanVss
parent e97e00de03
commit 112f59dd90
2 changed files with 19 additions and 11 deletions

View File

@@ -1,14 +1,15 @@
import { dirname, join } from "path";
import { StorybookConfig } from "@storybook/react-vite"; import { StorybookConfig } from "@storybook/react-vite";
import remarkGfm from "remark-gfm"; import remarkGfm from 'remark-gfm';
const config: StorybookConfig = { const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [ addons: [
"@storybook/addon-links", getAbsolutePath("@storybook/addon-links"),
"@storybook/addon-essentials", getAbsolutePath("@storybook/addon-essentials"),
"@storybook/addon-interactions", getAbsolutePath("@storybook/addon-interactions"),
"@storybook/addon-a11y", getAbsolutePath("@storybook/addon-a11y"),
"@storybook/preset-scss", getAbsolutePath("@storybook/preset-scss"),
{ {
name: "@storybook/addon-docs", name: "@storybook/addon-docs",
options: { options: {
@@ -20,14 +21,14 @@ const config: StorybookConfig = {
}, },
}, },
], ],
framework: { framework: {
name: "@storybook/react-vite", name: getAbsolutePath("@storybook/react-vite"),
options: {}, options: {},
}, },
staticDirs: ["../src", "../public"], staticDirs: ["../src", "../public"],
features: {
storyStoreV7: true,
},
async viteFinal(config, options) { async viteFinal(config, options) {
// We don't want the Storybook build to generate type definitions. // We don't want the Storybook build to generate type definitions.
const newConfig = { const newConfig = {
@@ -41,6 +42,13 @@ const config: StorybookConfig = {
}; };
return newConfig; return newConfig;
}, },
docs: {
autodocs: false
}
}; };
export default config; export default config;
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}

View File

@@ -1,7 +1,7 @@
import { addons, types, useStorybookApi } from '@storybook/manager-api'; import { addons, types, useStorybookApi } from '@storybook/manager-api';
import { getThemeFromGlobals, themes } from './themes'; import { getThemeFromGlobals, themes } from './themes';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { useGlobals } from '@storybook/api'; import { useGlobals } from '@storybook/manager-api';
addons.setConfig({ theme: themes.default }); addons.setConfig({ theme: themes.default });