Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module.exports = {
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
'plugin:@typescript-eslint/recommended',
'plugin:storybook/recommended'
],
rules: {
'import/no-webpack-loader-syntax': 0,
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ reports/
.DS_Store
npm-debug.log
.idea
.tsconfig-lint.json
.tsconfig-lint.json
*storybook.log
3 changes: 0 additions & 3 deletions .storybook/addons.js

This file was deleted.

36 changes: 0 additions & 36 deletions .storybook/config.js

This file was deleted.

20 changes: 20 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { StorybookConfig } from '@storybook/react-webpack5';

const config: StorybookConfig = {
addons: [
'@storybook/addon-webpack5-compiler-swc',
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
'storybook-addon-intl'
],
framework: {
name: '@storybook/react-webpack5',
options: {}
},
stories: ['../app/components/**/stories/**/*.mdx', '../app/components/**/stories/**/*.stories.@(js|jsx|mjs|ts|tsx)']
};
export default config;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also can we add the configuration to auto generate docs

docs: {
autodocs: true
},

Copy link
Author

Choose a reason for hiding this comment

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

Right, done !

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need to also add support for lingui. Because we move from react intl to lingui

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Right, Thank you for pointing that out! I've now added support for lingui

27 changes: 27 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { translationMessages, appLocales, DEFAULT_LOCALE } from '../app/i18n';

import type { Preview } from '@storybook/react';

type TranslationMessages = {
[key: string]: { [key: string]: string };
};

const getMessages = (locale: string) => (translationMessages as TranslationMessages)[locale];

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i
}
},
intl: {
locales: appLocales,
defaultLocale: DEFAULT_LOCALE,
getMessages
}
}
};

export default preview;
1 change: 0 additions & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ module.exports = ({ config }) => {
});
config.resolve.modules.push('app');
config.resolve.extensions.push('.js', '.jsx', '.react.js');
config.module.rules[0].use[0].options.plugins = [require.resolve('babel-plugin-react-docgen')];
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is removed because the doc generation is done by default on the new version ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes , Post v6 doc-gen support is by default.

return config;
};
13 changes: 0 additions & 13 deletions app/components/Clickable/stories/Clickable.stories.js

This file was deleted.

13 changes: 13 additions & 0 deletions app/components/Clickable/stories/clickable.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { Meta, Story } from '@storybook/react';
import { Clickable } from '../index';

export default {
title: 'Clickable',
component: Clickable
};

const ClickableTemplate = (args) => <Clickable {...args} />;

export const ClickableStoryComponent = ClickableTemplate.bind({});
ClickableStoryComponent.args = {};
27 changes: 16 additions & 11 deletions app/components/Header/stories/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/**
*
* Stories for Header
*
* @see https://github.com/storybookjs/storybook
*
*/

import React from 'react';
import { storiesOf } from '@storybook/react';
import { text } from '@storybook/addon-knobs';
import { MemoryRouter } from 'react-router-dom';
import Header from '../index';

storiesOf('Header').add('simple', () => <Header id={text('id', 'Header')} />);
export default {
title: 'Header',
component: Header
};

const HeaderTemplate = (args) => (
<MemoryRouter>
<Header {...args} />
</MemoryRouter>
);

export const HeaderStoryComponent = HeaderTemplate.bind({});
HeaderStoryComponent.args = {
id: 'Header'
};
47 changes: 23 additions & 24 deletions app/components/LaunchList/stories/LaunchList.stories.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
/**
*
* Stories for LaunchList
*
* @see https://github.com/storybookjs/storybook
*
*/

import React from 'react';
import { storiesOf } from '@storybook/react';
import { LaunchList } from '../index';
import LaunchList from '../index';

const loading = false;
const launchData = {
launches: [
{
id: '1',
launchDateUtc: '2014-01-06T14:06:00',
missionName: 'Thaicom 6',
links: {
wikipedia: 'https://en.wikipedia.org/wiki/Thaicom_6',
flickrImages: ['https://farm9.staticflickr.com/8617/16789019815_f99a165dc5_o.jpg']
}
}
]
export default {
title: 'LaunchList',
component: LaunchList
};

storiesOf('LaunchList').add('simple', () => <LaunchList launchData={launchData} loading={loading} />);
const LaunchListTemplate = (args) => <LaunchList {...args} />;

export const LaunchListStoryComponent = LaunchListTemplate.bind({});
LaunchListStoryComponent.args = {
launchData: {
launches: [
{
id: '1',
launchDateUtc: '2014-01-06T14:06:00',
missionName: 'Thaicom 6',
links: {
wikipedia: 'https://en.wikipedia.org/wiki/Thaicom_6',
flickrImages: ['https://farm9.staticflickr.com/8617/16789019815_f99a165dc5_o.jpg']
}
}
]
},
loading: false
};
15 changes: 0 additions & 15 deletions app/components/T/stories/T.stories.js

This file was deleted.

3 changes: 2 additions & 1 deletion internals/webpack/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ module.exports = (options) => ({
},
pngquant: {
quality: [0.65, 0.9],
speed: 4
speed: 4,
enabled: false
},
webp: {
quality: 75
Expand Down
29 changes: 19 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"engines": {
"npm": ">=5",
"node": ">=8.15.1 <17.9.1"
"node": ">=8.15.1"
},
"author": "Mac",
"homepage": "https://github.com/wednesday-solutions/react-graphql-ts-template",
Expand All @@ -25,7 +25,7 @@
"build:prod": "export ENVIRONMENT_NAME=production && npm run compile-lingui && cross-env NODE_ENV=production webpack --config internals/webpack/webpack.config.prod.js --color --progress --stats-children --stats-error-details",
"build:dev": "export ENVIRONMENT_NAME=development && cross-env NODE_ENV=production webpack --config internals/webpack/webpack.config.dev.js --color --progress",
"build:clean": "rimraf ./build",
"start": "export ENVIRONMENT_NAME=local && concurrently -c green.bold,blue.bold -n WEBPACK,TYPESCRIPT \"cross-env NODE_ENV=development node server\" \"yarn tsc:watch\"",
"start": "export NODE_OPTIONS=--openssl-legacy-provider ENVIRONMENT_NAME=local && concurrently -c green.bold,blue.bold -n WEBPACK,TYPESCRIPT \"cross-env NODE_ENV=development node server\" \"yarn tsc:watch\"",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
"start:production": "npm run test && npm run build:prod && npm run start:prod",
"start:prod": "cross-env NODE_ENV=production node server",
Expand All @@ -51,8 +51,8 @@
"create:badges": "jest-coverage-badges --output './badges'",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"prettify": "prettier --write",
"storybook": "export ENVIRONMENT_NAME=development && start-storybook -p 6006",
"build-storybook": "export ENVIRONMENT_NAME=production && build-storybook",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"initialize": "git checkout --orphan temp-branch && git add -A && git commit -m 'Initial commit' && git branch -D master && git branch -m master",
"generate": "react-generate"
},
Expand Down Expand Up @@ -81,6 +81,7 @@
"@lingui/react": "^4.11.2",
"@redux-devtools/extension": "^3.2.2",
"@reduxjs/toolkit": "^1.8.0",
"@storybook/addon-a11y": "^8.2.9",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this in dependencies ? It should go to dev dependency ?

Copy link
Author

Choose a reason for hiding this comment

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

Right, Thank you for pointing that out! I've moved it to devDependencies as suggested.

"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"antd": "^4.9.3",
Expand Down Expand Up @@ -136,18 +137,24 @@
"@babel/plugin-transform-react-inline-elements": "7.14.5",
"@babel/preset-env": "^7.14.7",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.16.7",
"@babel/preset-typescript": "^7.24.7",
"@babel/register": "7.14.5",
"@babel/runtime": "^7.14.6",
"@chromatic-com/storybook": "^1.6.1",
"@lcdp/offline-plugin": "^5.1.0",
"@lingui/cli": "^4.11.2",
"@lingui/format-json": "^4.11.2",
"@lingui/macro": "^4.11.2",
"@storybook/addon-actions": "^5.2.1",
"@storybook/addon-knobs": "^5.2.1",
"@storybook/addon-links": "^5.2.1",
"@storybook/addon-onboarding": "^8.2.9",
"@storybook/addon-webpack5-compiler-swc": "^1.0.5",
"@storybook/addons": "^5.2.1",
"@storybook/react": "^5.2.1",
"@storybook/blocks": "^8.2.9",
"@storybook/react": "^8.2.9",
"@storybook/react-webpack5": "^8.2.9",
"@storybook/test": "^8.2.9",
"@types/intl": "^1.2.0",
"@types/invariant": "^2.2.35",
"@types/lodash-es": "^4.17.6",
Expand All @@ -165,7 +172,7 @@
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "^27.5.1",
"babel-loader": "^8.2.2",
"babel-loader": "^9.1.3",
"babel-plugin-dynamic-import-node": "2.3.3",
"babel-plugin-import": "^1.13.3",
"babel-plugin-lodash": "^3.3.4",
Expand Down Expand Up @@ -195,6 +202,7 @@
"eslint-plugin-react-native": "3.7.0",
"eslint-plugin-redux-saga": "1.1.3",
"eslint-plugin-standard": "4.0.1",
"eslint-plugin-storybook": "^0.8.0",
"file-loader": "6.2.0",
"html-loader": "2.1.2",
"html-webpack-plugin": "5.3.2",
Expand All @@ -219,8 +227,8 @@
"react-floki": "^1.0.70",
"rimraf": "2.6.3",
"shelljs": "0.8.3",
"storybook-addon-intl": "^2.4.1",
"storybook-addon-smart-knobs": "^5.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not required now ? Why is this removed ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, this is not required. As of versions > v6 we can now use @storybook/addon-controls for dynamically editing props, therefore eliminating the need for an additional addon-smart-knobs

Copy link
Collaborator

Choose a reason for hiding this comment

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

@storybook/addon-controls is required to be added or it comes by default ?

Copy link
Author

Choose a reason for hiding this comment

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

@storybook/addon-controls needs to be added ( recommended )

"storybook": "^8.2.9",
"storybook-addon-intl": "^4.0.0",
"storybook-router": "^0.3.4",
"style-loader": "2.0.0",
"stylelint": "10.0.1",
Expand All @@ -229,7 +237,8 @@
"stylelint-processor-styled-components": "1.6.0",
"svg-url-loader": "7.1.1",
"terser-webpack-plugin": "5.1.3",
"typescript": "^4.6.2",
"ts-loader": "^9.5.1",
"typescript": "^5.5.4",
"url-loader": "4.1.1",
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.4.2",
Expand Down
Loading