Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storybook): Fix always updating storybook #1301

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions packages/ui-tests/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { StorybookConfig } from '@storybook/react-vite';

import { dirname, join } from 'path';
import packageJson from '../../../package.json';

/**
* This function is used to resolve the absolute path of a package.
Expand All @@ -17,15 +18,13 @@ const config: StorybookConfig = {
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-onboarding'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath('storybook-addon-react-router-v6'),
getAbsolutePath('storybook-addon-remix-react-router'),
],
framework: {
name: getAbsolutePath('@storybook/react-vite'),
options: {},
},
docs: {
autodocs: true,
},
docs: {},
// Configures the static asset folder in> Storybook
// Requires the catalog-generator build
staticDirs: [{ from: '../../catalog-generator/dist/camel-catalog', to: 'camel-catalog' }],
Expand All @@ -39,5 +38,16 @@ const config: StorybookConfig = {
prop.parent ? !/node_modules/.test(prop.parent.fileName) : true,
},
},
viteFinal: async (config) => {
return {
...config,
define: {
...config.define,
__GIT_HASH: JSON.stringify('Demo hash'),
__GIT_DATE: JSON.stringify('1970-01-01T00:00:00Z'),
__KAOTO_VERSION: JSON.stringify(packageJson.version),
Comment on lines +46 to +48
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tplevko this viteFinal field serves as an override for vite config, so we're taking the opportunity to set a fixed __GIT_HASH and __GIT_DATE to avoid having changes on the AboutModal on every build.

},
};
},
};
export default config;
2 changes: 2 additions & 0 deletions packages/ui-tests/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const preview: Preview = {
},
},
},

tags: ['autodocs']
};

export default preview;
34 changes: 17 additions & 17 deletions packages/ui-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
},
"devDependencies": {
"@kaoto/kaoto": "workspace:*",
"@storybook/addon-essentials": "^8.0.0",
"@storybook/addon-interactions": "^8.0.0",
"@storybook/addon-links": "^8.0.0",
"@storybook/addon-onboarding": "^8.0.0",
"@storybook/blocks": "^8.0.0",
"@storybook/channels": "^8.0.0",
"@storybook/components": "^8.0.0",
"@storybook/core-events": "^8.0.0",
"@storybook/manager-api": "^8.0.0",
"@storybook/preview-api": "^8.0.0",
"@storybook/react": "^8.0.0",
"@storybook/react-vite": "^8.0.0",
"@storybook/testing-library": "^0.2.0",
"@storybook/theming": "^8.0.0",
"@storybook/addon-essentials": "^8.2.8",
"@storybook/addon-interactions": "^8.2.8",
"@storybook/addon-links": "^8.2.8",
"@storybook/addon-onboarding": "^8.2.8",
"@storybook/blocks": "^8.2.8",
"@storybook/channels": "^8.2.8",
"@storybook/components": "^8.2.8",
"@storybook/core-events": "^8.2.8",
"@storybook/manager-api": "^8.2.8",
"@storybook/preview-api": "^8.2.8",
"@storybook/react": "^8.2.8",
"@storybook/react-vite": "^8.2.8",
"@storybook/testing-library": "^0.2.2",
"@storybook/theming": "^8.2.8",
"chromatic": "^11.0.0",
"cypress": "^13.11.0",
"cypress-file-upload": "^5.0.8",
Expand All @@ -49,19 +49,19 @@
"eslint-plugin-react-refresh": "^0.4.3",
"eslint-plugin-storybook": "^0.8.0",
"msw": "^2.0.2",
"msw-storybook-addon": "^2.0.0",
"msw-storybook-addon": "^2.0.3",
"prettier": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.14.1",
"start-server-and-test": "^2.0.0",
"storybook-addon-react-router-v6": "^2.0.7",
"storybook-addon-remix-react-router": "^3.0.0",
"storybook-fixtures": "0.12.0",
"typescript": "^5.4.2",
"vite": "^4.4.5"
},
"dependencies": {
"storybook": "^8.0.0"
"storybook": "^8.2.8"
},
"eslintConfig": {
"extends": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Navigation, Shell, SourceCodeProvider } from '@kaoto/kaoto/testing';
import { StoryFn } from '@storybook/react';
import { withRouter, reactRouterOutlet, reactRouterParameters } from 'storybook-addon-react-router-v6';
import { withRouter, reactRouterOutlet, reactRouterParameters } from 'storybook-addon-remix-react-router';

export default {
title: 'Navigation/Navigation',
Expand Down
Loading
Loading