-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup design system playground
- Loading branch information
Showing
60 changed files
with
11,281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:storybook/recommended", | ||
"plugin:tailwindcss/recommended", | ||
"prettier", | ||
], | ||
ignorePatterns: ["dist", ".eslintrc.cjs"], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["react-refresh"], | ||
rules: { | ||
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Storybook Tests After Deployment | ||
on: deployment_status # deployment_status is triggered when a deployment is created or updated, for example on vercel, and you can get the URL from there | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
if: github.event.deployment_status.state == 'success' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
run_install: false | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Cache Playwright browsers | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/ms-playwright | ||
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-playwright- | ||
- name: Install Playwright | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run Storybook tests | ||
run: pnpm test | ||
env: | ||
TARGET_URL: "${{ github.event.deployment_status.target_url }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: "Storybook Tests" | ||
on: push | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
run_install: false | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Cache Playwright browsers | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/ms-playwright | ||
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-playwright- | ||
- name: Install Playwright | ||
run: npx playwright install --with-deps | ||
|
||
- name: Cache Storybook build | ||
uses: actions/cache@v4 | ||
with: | ||
path: storybook-static | ||
key: ${{ runner.os }}-storybook-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-storybook- | ||
- name: Build Storybook | ||
run: pnpm build-storybook --quiet | ||
|
||
- name: Serve Storybook and run tests | ||
run: | | ||
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | ||
"npx http-server storybook-static --port 6006 --silent" \ | ||
"npx wait-on tcp:127.0.0.1:6006 && pnpm test-storybook" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
|
||
.env | ||
storybook-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pnpm exec lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Use pnpm for package management | ||
package-manager=pnpm@9 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"useTabs": false, | ||
"singleQuote": false, | ||
"trailingComma": "all", | ||
"semi": true, | ||
"printWidth": 100, | ||
"plugins": ["prettier-plugin-tailwindcss"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { StorybookConfig } from "@storybook/react-vite"; | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
"@storybook/addon-interactions", | ||
"@storybook/addon-themes", | ||
"@storybook/addon-a11y", | ||
], | ||
framework: { | ||
name: "@storybook/react-vite", | ||
options: {}, | ||
}, | ||
docs: {}, | ||
core: { | ||
disableTelemetry: true, // 👈 Used to ignore update notifications. | ||
}, | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { Preview } from "@storybook/react"; | ||
import { withThemeByDataAttribute } from "@storybook/addon-themes"; | ||
import { initialize, mswLoader } from "msw-storybook-addon"; | ||
import { handlers } from "../src/mocks/handlers"; | ||
|
||
initialize(); | ||
|
||
import "../src/index.css"; | ||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
msw: { | ||
handlers, | ||
}, | ||
}, | ||
decorators: [ | ||
withThemeByDataAttribute({ | ||
defaultTheme: "light", | ||
themes: { light: "light", dark: "dark" }, | ||
attributeName: "data-mode", | ||
}), | ||
], | ||
loaders: [mswLoader], | ||
}; | ||
|
||
// NOTE: Example of global loaders | ||
// export const loaders = [ | ||
// async () => ({ | ||
// userData: await fetch('/api/user').then((res) => res.json()), | ||
// }), | ||
// ]; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { TestRunnerConfig } from "@storybook/test-runner"; | ||
import { injectAxe, checkA11y } from "axe-playwright"; | ||
|
||
const config: TestRunnerConfig = { | ||
async preVisit(page) { | ||
await injectAxe(page); | ||
}, | ||
async postVisit(page) { | ||
await checkA11y(page, "#storybook-root", { | ||
detailedReport: true, | ||
detailedReportOptions: { | ||
html: true, | ||
}, | ||
}); | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>DeSy Example</title> | ||
</head> | ||
<body> | ||
<div id="root"> | ||
<p> | ||
Please start this project by running <code>npm run storybook</code> from the command line. | ||
</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"name": "desy-example", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "npm run storybook", | ||
"test": "test-storybook", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"format": "prettier --write --ignore-unknown .", | ||
"preview": "vite preview", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build", | ||
"prepare": "husky", | ||
"chromatic": "chromatic" | ||
}, | ||
"lint-staged": { | ||
"**/*": "prettier --write --ignore-unknown" | ||
}, | ||
"msw": { | ||
"workerDirectory": [ | ||
"public" | ||
] | ||
}, | ||
"dependencies": { | ||
"@fontsource-variable/inter": "^5.0.18", | ||
"lucide-react": "0.368.0", | ||
"react": "18.3.1", | ||
"react-dom": "18.3.1" | ||
}, | ||
"devDependencies": { | ||
"@chromatic-com/storybook": "^2.0.2", | ||
"@storybook/addon-a11y": "^8.3.3", | ||
"@storybook/addon-essentials": "^8.3.3", | ||
"@storybook/addon-interactions": "^8.3.3", | ||
"@storybook/addon-links": "^8.3.3", | ||
"@storybook/addon-themes": "^8.3.3", | ||
"@storybook/blocks": "^8.3.3", | ||
"@storybook/react": "^8.3.3", | ||
"@storybook/react-vite": "^8.3.3", | ||
"@storybook/test": "^8.3.3", | ||
"@storybook/test-runner": "^0.19.1", | ||
"@types/react": "18.3.3", | ||
"@types/react-dom": "18.3.0", | ||
"@typescript-eslint/eslint-plugin": "7.12.0", | ||
"@typescript-eslint/parser": "7.12.0", | ||
"@vitejs/plugin-react": "4.3.0", | ||
"autoprefixer": "10.4.19", | ||
"axe-playwright": "2.0.1", | ||
"chromatic": "^11.10.4", | ||
"class-variance-authority": "0.7.0", | ||
"clsx": "2.1.1", | ||
"concurrently": "^9.0.1", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "8.10.0", | ||
"eslint-plugin-react-hooks": "4.6.2", | ||
"eslint-plugin-react-refresh": "0.4.7", | ||
"eslint-plugin-storybook": "^0.9.0", | ||
"eslint-plugin-tailwindcss": "^3.17.4", | ||
"http-server": "^14.1.1", | ||
"husky": "9.0.11", | ||
"lint-staged": "15.2.5", | ||
"msw": "2.3.1", | ||
"msw-storybook-addon": "^2.0.3", | ||
"playwright": "^1.47.2", | ||
"postcss": "8.4.38", | ||
"prettier": "3.3.1", | ||
"prettier-plugin-tailwindcss": "0.5.14", | ||
"storybook": "^8.3.3", | ||
"tailwind-merge": "^2.5.2", | ||
"tailwindcss": "3.4.4", | ||
"typescript": "5.4.5", | ||
"vite": "5.2.12", | ||
"vitest": "1.6.0", | ||
"wait-on": "^8.0.1" | ||
} | ||
} |
Oops, something went wrong.