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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Storybook into the boilerplate #112

Merged
merged 7 commits into from
Apr 5, 2023
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
out
!.storybook
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@
"parserOptions": {
"project": "./cypress/tsconfig.json"
}
},
// Configuration for Storybook
{
"files": ["*.stories.*"],
"extends": ["plugin:storybook/recommended"],
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
]
}
}
]
}
3 changes: 3 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
- name: Run unit tests
run: npm run test

- name: Run storybook tests
run: npm run test-storybook:ci

- name: Run e2e tests
run: npx percy exec -- npm run e2e:headless
env:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# testing
/coverage

# storybook
storybook-static

# cypress
cypress/screenshots
cypress/videos
Expand Down
22 changes: 22 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { StorybookConfig } from '@storybook/nextjs';

const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/nextjs',
options: {},
},
docs: {
autodocs: 'tag',
},
core: {
disableTelemetry: true,
},
};

export default config;
17 changes: 17 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import '../src/styles/global.css';

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

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Developer experience first:
- 馃 Unit Testing with Jest and React Testing Library
- 馃И E2E Testing with Cypress
- 馃懛 Run tests on pull request with GitHub Actions
- 馃帀 Storybook for UI development
- 馃巵 Automatic changelog generation with Semantic Release
- 馃攳 Visual testing with Percy (Optional)
- 馃挕 Absolute Imports using `@` prefix
Expand Down
Loading