Skip to content

Commit 89895f8

Browse files
feat(gwasAppSetup): Initial commit (#5)
* feat(gwasAppSetup): Initial commit * feat(gwasAppSetup): Fixed 508 issues * feat(gwasAppSetup): Got storybook to work and added CI test * feat(gwasAppSetup): Edited CI test to match Spike CI test
1 parent 6afdcee commit 89895f8

File tree

138 files changed

+26261
-4553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+26261
-4553
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
'plugin:@typescript-eslint/recommended',
1313
'plugin:@next/next/recommended',
1414
'prettier',
15+
'plugin:storybook/recommended',
1516
],
1617
parser: '@typescript-eslint/parser',
1718
parserOptions: {
@@ -23,7 +24,7 @@ module.exports = {
2324
},
2425
plugins: ['jsx-a11y', 'react', 'react-hooks', '@typescript-eslint'],
2526
rules: {
26-
'@typescript-eslint/no-explicit-any':['warn'],
27+
'@typescript-eslint/no-explicit-any': ['warn'],
2728
'no-underscore-dangle': 'off',
2829
'import/prefer-default-export': 'off',
2930
'linebreak-style': ['error', 'unix'],

.github/workflows/ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
name: CI
22
on: push
33
jobs:
4+
interaction-and-accessibility:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
with:
9+
fetch-depth: 0
10+
- uses: actions/setup-node@v4
11+
with:
12+
node-version: 20.17.0
13+
- name: Install dependencies
14+
run: npm install
15+
- name: Install Playwright
16+
run: npx playwright install --with-deps
17+
- name: Build Storybook
18+
run: npm run build-storybook --quiet
19+
- name: Serve Storybook and run tests
20+
run: |
21+
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
22+
"npx http-server storybook-static --port 6006 --silent" \
23+
"npx wait-on tcp:6006 && yarn test-storybook"
424
build:
525
runs-on: ubuntu-latest
626
steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ yarn-error.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36+
37+
*storybook.log

.storybook/main.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { StorybookConfig } from '@storybook/nextjs';
2+
3+
const config: StorybookConfig = {
4+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5+
addons: [
6+
'@storybook/addon-onboarding',
7+
'@storybook/addon-essentials',
8+
'@chromatic-com/storybook',
9+
'@storybook/addon-interactions',
10+
'@storybook/addon-a11y',
11+
],
12+
framework: {
13+
name: '@storybook/nextjs',
14+
options: {},
15+
},
16+
staticDirs: ['../public'],
17+
webpackFinal: async (config) => {
18+
const imageRule = config.module?.rules?.find((rule) => {
19+
const test = (rule as { test: RegExp }).test;
20+
21+
if (!test) {
22+
return false;
23+
}
24+
25+
return test.test('.svg');
26+
}) as { [key: string]: any };
27+
28+
imageRule.exclude = /\.svg$/;
29+
30+
config.module?.rules?.push({
31+
test: /\.svg$/,
32+
use: ['@svgr/webpack'],
33+
});
34+
35+
return config;
36+
},
37+
};
38+
export default config;

.storybook/preview.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react';
2+
import type { Preview } from '@storybook/react';
3+
import { MantineProvider } from '@mantine/core';
4+
import '../src/styles/globals.css';
5+
import { initialize, mswLoader } from 'msw-storybook-addon';
6+
7+
/*
8+
* Initializes MSW
9+
* See https://github.com/mswjs/msw-storybook-addon#configuring-msw
10+
* to learn how to customize it
11+
*/
12+
initialize();
13+
14+
const preview: Preview = {
15+
parameters: {
16+
controls: {
17+
matchers: {
18+
color: /(background|color)$/i,
19+
date: /Date$/i,
20+
},
21+
},
22+
},
23+
tags: ['autodocs'],
24+
decorators: [
25+
(Story) => (
26+
<MantineProvider>
27+
<Story />
28+
</MantineProvider>
29+
),
30+
],
31+
loaders: [mswLoader], // 👈 Adds the MSW loader to all stories
32+
};
33+
34+
export default preview;

.storybook/test-runner.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { TestRunnerConfig } from '@storybook/test-runner';
2+
import { injectAxe, checkA11y } from 'axe-playwright';
3+
4+
/*
5+
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api
6+
* to learn more about the test-runner hooks API.
7+
*/
8+
const config: TestRunnerConfig = {
9+
async preVisit(page) {
10+
await injectAxe(page);
11+
},
12+
async postVisit(page) {
13+
await checkA11y(page, '#storybook-root', {
14+
detailedReport: true,
15+
detailedReportOptions: {
16+
html: true,
17+
},
18+
});
19+
},
20+
};
21+
22+
export default config;

0 commit comments

Comments
 (0)