Skip to content

Commit 0af2cbc

Browse files
beaussanhasura-bot
authored andcommitted
console: fix storybook build
PR-URL: hasura/graphql-engine-mono#2441 GitOrigin-RevId: f7a04b2
1 parent a7cc5df commit 0af2cbc

8 files changed

Lines changed: 57 additions & 141 deletions

File tree

‎console/.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ test
1414
**/.tern-port
1515
packages/console-oss/build/
1616
lib/
17-
hasura-console-oss-1.0.0.tgz
17+
hasura-console-oss-1.0.0.tgz
18+
storybook-static

‎console/.storybook/main.js‎

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
const util = require('util');
22
const webpack = require('webpack');
33

4+
const isConfigDebugMode = process.env.STORYBOOK_CONFIG_LOG === 'debug';
5+
46
module.exports = {
5-
features: {
6-
previewCsfV3: true,
7-
},
87
stories: [
98
'../src/**/*.stories.mdx',
109
'../src/**/*.stories.@(js|jsx|ts|tsx|mdx)',
1110
],
1211
babel: async options => {
13-
console.log('------BABEL--------');
14-
console.log(util.inspect(options, { showHidden: false, depth: null }));
12+
if (isConfigDebugMode) {
13+
console.log('------BABEL--------');
14+
console.log(util.inspect(options, { showHidden: false, depth: null }));
15+
}
1516
return options;
1617
},
1718
webpackFinal: async (config, { configType }) => {
1819
const newConfig = {
1920
...config,
20-
entry: [
21-
'bootstrap-loader?extractStyles',
22-
'font-awesome-webpack!./src/theme/font-awesome.config.js',
23-
...config.entry,
24-
],
2521
module: {
2622
...config.module,
2723
rules: [
@@ -56,10 +52,6 @@ module.exports = {
5652
},
5753
plugins: [
5854
...config.plugins,
59-
new webpack.ProvidePlugin({
60-
$: 'jquery',
61-
jQuery: 'jquery',
62-
}),
6355
new webpack.DefinePlugin({
6456
CONSOLE_ASSET_VERSION: Date.now().toString(),
6557
'process.hrtime': () => null,
@@ -71,9 +63,10 @@ module.exports = {
7163
],
7264
};
7365

74-
console.log('------WEBPACK--------');
75-
console.log(util.inspect(newConfig, { showHidden: false, depth: null }));
76-
// console.log(util.inspect(config, { showHidden: false, depth: null }));
66+
if (isConfigDebugMode) {
67+
console.log('------WEBPACK--------');
68+
console.log(util.inspect(newConfig, { showHidden: false, depth: null }));
69+
}
7770

7871
// Return the altered config
7972
return newConfig;

‎console/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
3232
"jest-watch": "jest --watch --setupFiles dotenv/config",
3333
"jest": "jest --setupFiles dotenv/config",
34+
"chromatic": "npx chromatic",
3435
"storybook": "start-storybook -p 6006 -s static --no-manager-cache",
35-
"build-storybook": "build-storybook"
36+
"build-storybook": "build-storybook -s static"
3637
},
3738
"lint-staged": {
3839
"*.{js,ts,tsx}": [

‎console/src/components/Services/Data/Schema/TemplateGallery/TemplateGalleryModal.stories.tsx‎

Lines changed: 0 additions & 59 deletions
This file was deleted.

‎console/src/components/Services/Data/Schema/TemplateGallery/TemplateGalleryTable.stories.tsx‎

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Meta } from '@storybook/addon-docs';
2+
3+
<Meta title="Dev/Storybook" />
4+
5+
<div class="prose">
6+
7+
# Storybook
8+
9+
10+
Here are the current limitation when porting component to storybook :
11+
12+
* There is no bootstrap setup inside of storybook, this is because of 2 main reasons :
13+
* The current boostrap version (3) has some incompatibility and is imported in the codebase through webpack as an entry point
14+
* We want to move all the component to tailwindcss
15+
16+
17+
This is still an in progress effort.
18+
19+
20+
</div>
21+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import { ComponentMeta, ComponentStory } from '@storybook/react';
3+
4+
const ExampleComponent: React.FC = ({ children }) => (
5+
<div className="p-4 border bg-gray-200 shadow">{children}</div>
6+
);
7+
8+
export default {
9+
title: 'components/ExampleComponent',
10+
component: ExampleComponent,
11+
} as ComponentMeta<typeof ExampleComponent>;
12+
13+
export const ExampleStory: ComponentStory<typeof ExampleComponent> = () => (
14+
<ExampleComponent>Test story</ExampleComponent>
15+
);

‎console/tailwind.config.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ module.exports = {
4444
lg: ['1.125rem', { lineHeight: '1.5rem' }],
4545
xl: ['2.25rem', { lineHeight: '2.5rem' }],
4646
},
47+
typography: {
48+
DEFAULT: {
49+
css: {
50+
maxWidth: '100%',
51+
},
52+
},
53+
},
4754
},
4855
},
4956
plugins: [require('@tailwindcss/typography'), require('@tailwindcss/forms')],

0 commit comments

Comments
 (0)