Skip to content

Commit

Permalink
update storybook and run codemods
Browse files Browse the repository at this point in the history
  • Loading branch information
bnussman committed Jan 2, 2025
1 parent 6368f20 commit d755ece
Show file tree
Hide file tree
Showing 4 changed files with 364 additions and 845 deletions.
24 changes: 14 additions & 10 deletions packages/manager/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dirname, join } from 'path';
import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';

Expand All @@ -8,18 +9,18 @@ const config: StorybookConfig = {
'../../ui/src/components/**/*.@(mdx|stories.@(js|ts|jsx|tsx))',
],
addons: [
'@storybook/addon-docs',
'@storybook/addon-controls',
'@storybook/addon-viewport',
'@storybook/addon-measure',
'@storybook/addon-actions',
'storybook-dark-mode',
'@storybook/addon-storysource',
'@storybook/addon-a11y',
getAbsolutePath('@storybook/addon-docs'),
getAbsolutePath('@storybook/addon-controls'),
getAbsolutePath('@storybook/addon-viewport'),
getAbsolutePath('@storybook/addon-measure'),
getAbsolutePath('@storybook/addon-actions'),
getAbsolutePath('storybook-dark-mode'),
getAbsolutePath('@storybook/addon-storysource'),
getAbsolutePath('@storybook/addon-a11y'),
],
staticDirs: ['../public'],
framework: {
name: '@storybook/react-vite',
name: getAbsolutePath('@storybook/react-vite'),
options: {},
},
typescript: {
Expand All @@ -42,7 +43,6 @@ const config: StorybookConfig = {
reactDocgen: 'react-docgen-typescript',
},
docs: {
autodocs: true,
defaultName: 'Documentation',
},
async viteFinal(config) {
Expand Down Expand Up @@ -70,3 +70,7 @@ const config: StorybookConfig = {
};

export default config;

function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')));
}
4 changes: 4 additions & 0 deletions packages/manager/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ const preview: Preview = {
: wrapWithTheme(<Story />, { theme: isDark ? 'dark' : 'light' });
},
],

loaders: [
async () => ({
msw: await storybookWorker?.start(),
}),
],

parameters: {
backgrounds: {
grid: {
Expand Down Expand Up @@ -106,6 +108,8 @@ const preview: Preview = {
),
},
},

tags: ['autodocs'],
};

export default preview;
30 changes: 15 additions & 15 deletions packages/manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@
},
"devDependencies": {
"@linode/eslint-plugin-cloud-manager": "^0.0.5",
"@storybook/addon-a11y": "^8.3.0",
"@storybook/addon-actions": "^8.3.0",
"@storybook/addon-controls": "^8.3.0",
"@storybook/addon-docs": "^8.3.0",
"@storybook/addon-mdx-gfm": "^8.3.0",
"@storybook/addon-measure": "^8.3.0",
"@storybook/addon-storysource": "^8.3.0",
"@storybook/addon-viewport": "^8.3.0",
"@storybook/blocks": "^8.3.0",
"@storybook/manager-api": "^8.3.0",
"@storybook/preview-api": "^8.3.0",
"@storybook/react": "^8.3.0",
"@storybook/react-vite": "^8.3.0",
"@storybook/theming": "^8.3.0",
"@storybook/addon-a11y": "^8.4.7",
"@storybook/addon-actions": "^8.4.7",
"@storybook/addon-controls": "^8.4.7",
"@storybook/addon-docs": "^8.4.7",
"@storybook/addon-mdx-gfm": "^8.4.7",
"@storybook/addon-measure": "^8.4.7",
"@storybook/addon-storysource": "^8.4.7",
"@storybook/addon-viewport": "^8.4.7",
"@storybook/blocks": "^8.4.7",
"@storybook/manager-api": "^8.4.7",
"@storybook/preview-api": "^8.4.7",
"@storybook/react": "^8.4.7",
"@storybook/react-vite": "^8.4.7",
"@storybook/theming": "^8.4.7",
"@swc/core": "^1.3.1",
"@testing-library/cypress": "^10.0.2",
"@testing-library/dom": "^10.1.0",
Expand Down Expand Up @@ -202,7 +202,7 @@
"msw": "^2.2.3",
"prettier": "~2.2.1",
"redux-mock-store": "^1.5.3",
"storybook": "^8.3.0",
"storybook": "^8.4.7",
"storybook-dark-mode": "4.0.1",
"vite": "^5.4.6",
"vite-plugin-svgr": "^3.2.0"
Expand Down
Loading

0 comments on commit d755ece

Please sign in to comment.