Skip to content

Commit

Permalink
[BEEEP] [PM-10132] Upgrade storybook to v8 (#10288)
Browse files Browse the repository at this point in the history
Upgrade storybook to version v8 which is a major upgrade. Storybook provides an
upgrade wizard which did most of the work.

- Ran npx storybook upgrade.
- Manually updated `remark-gfm` since the newer mdx requires v 4.
- Migrated all old stories still using `Story` to `StoryObj`.
  • Loading branch information
Hinton authored Aug 16, 2024
1 parent 92f87da commit 604e223
Show file tree
Hide file tree
Showing 18 changed files with 3,728 additions and 8,073 deletions.
22 changes: 13 additions & 9 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dirname, join } from "path";
import { StorybookConfig } from "@storybook/angular";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
import remarkGfm from "remark-gfm";
Expand All @@ -20,11 +21,11 @@ const config: StorybookConfig = {
"../bitwarden_license/bit-web/src/**/*.stories.@(js|jsx|ts|tsx)",
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-a11y",
"@storybook/addon-designs",
"@storybook/addon-interactions",
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-a11y"),
getAbsolutePath("@storybook/addon-designs"),
getAbsolutePath("@storybook/addon-interactions"),
{
name: "@storybook/addon-docs",
options: {
Expand All @@ -37,7 +38,7 @@ const config: StorybookConfig = {
},
],
framework: {
name: "@storybook/angular",
name: getAbsolutePath("@storybook/angular"),
options: {},
},
core: {
Expand All @@ -53,9 +54,12 @@ const config: StorybookConfig = {
}
return config;
},
docs: {
autodocs: true,
},
docs: {},
};

export default config;

// Recommended for mono-repositories
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}
2 changes: 1 addition & 1 deletion .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addons } from "@storybook/addons";
import { addons } from "@storybook/manager-api";
import { create } from "@storybook/theming/create";

const lightTheme = create({
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const preview: Preview = {
},
},
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
Expand All @@ -107,6 +106,7 @@ const preview: Preview = {
},
docs: { source: { type: "dynamic", excludeDecorators: true } },
},
tags: ["autodocs"],
};

export default preview;
Loading

0 comments on commit 604e223

Please sign in to comment.