Skip to content

Commit 9872e9b

Browse files
committed
Squash commits from feat/storybook
Combined commits: - chore(web): add storybook scripts and serve devDependency (#3) - feat: storybook - github actions to test - update justfile - update version - --wip-- - update - missing build command - fix command not found - fix storybook - update
1 parent 4b04c06 commit 9872e9b

19 files changed

Lines changed: 4185 additions & 380 deletions

.github/workflows/pr-tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
test:
9+
name: ${{ matrix.target }}
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
target:
16+
- test-app
17+
- test-auth
18+
- test-comments
19+
- test-follows
20+
- test-playground
21+
- test-polls
22+
- test-posts
23+
- test-reactions
24+
- test-uploads
25+
- test-users
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Install pnpm
32+
uses: pnpm/action-setup@v3
33+
with:
34+
version: 10.28.2
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 24.13.0
40+
cache: 'pnpm'
41+
42+
- name: Setup Just
43+
uses: extractions/setup-just@v2
44+
45+
- name: Install dependencies
46+
run: just setup
47+
48+
- name: Run ${{ matrix.target }}
49+
run: just ${{ matrix.target }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,3 +413,6 @@ http-client.private.env.json
413413
# Github Copilot persisted session migrations, see: https://github.com/microsoft/copilot-intellij-feedback/issues/712#issuecomment-3322062215
414414
.idea/**/copilot.data.migration.*.xml
415415
test-results/
416+
417+
418+
storybook-static

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Add files here to ignore them from prettier formatting
2+
/dist
3+
/coverage
4+
/.nx/cache
5+
/.nx/workspace-data

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

apps/web/.storybook/main.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { dirname, join } from 'path';
2+
3+
import type { StorybookConfig } from '@storybook/react-vite';
4+
5+
const config: StorybookConfig = {
6+
stories: ['../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
7+
addons: [
8+
getAbsolutePath('@storybook/addon-essentials'),
9+
getAbsolutePath('@storybook/addon-interactions'),
10+
],
11+
framework: {
12+
name: getAbsolutePath('@storybook/react-vite') as any,
13+
options: {
14+
builder: {
15+
viteConfigPath: 'vite.config.ts',
16+
},
17+
},
18+
},
19+
};
20+
21+
function getAbsolutePath(value: string): string {
22+
return dirname(require.resolve(join(value, 'package.json')));
23+
}
24+
25+
export default config;
26+
27+
// To customize your Vite configuration you can use the viteFinal field.
28+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
29+
// and https://nx.dev/recipes/storybook/custom-builder-configs

apps/web/.storybook/preview.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { Preview } from '@storybook/react';
2+
import { initialize, mswLoader } from 'msw-storybook-addon';
3+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4+
import React from 'react';
5+
import '../src/index.css';
6+
7+
// Initialize MSW
8+
initialize();
9+
10+
const queryClient = new QueryClient({
11+
defaultOptions: {
12+
queries: {
13+
retry: false,
14+
},
15+
},
16+
});
17+
18+
const preview: Preview = {
19+
parameters: {
20+
controls: {
21+
matchers: {
22+
color: /(background|color)$/i,
23+
date: /Date$/i,
24+
},
25+
},
26+
},
27+
loaders: [mswLoader],
28+
decorators: [
29+
(Story) => (
30+
<QueryClientProvider client={queryClient}>
31+
<Story />
32+
</QueryClientProvider>
33+
),
34+
],
35+
};
36+
37+
export default preview;

apps/web/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"build": "tsc -b && vite build",
1010
"lint": "eslint .",
1111
"preview": "vite preview",
12-
"seed": "tsx scripts/seed.ts"
12+
"seed": "tsx scripts/seed.ts",
13+
"build-storybook": "storybook build"
1314
},
1415
"dependencies": {
1516
"@assistant-ui/react": "^0.12.19",
@@ -53,6 +54,10 @@
5354
"devDependencies": {
5455
"@eslint/js": "^9.39.1",
5556
"@faker-js/faker": "^10.3.0",
57+
"@storybook/addon-essentials": "^8.6.18",
58+
"@storybook/addon-interactions": "^8.6.18",
59+
"@storybook/blocks": "^8.6.18",
60+
"@storybook/test": "^8.6.18",
5661
"@tailwindcss/typography": "^0.5.19",
5762
"@tanstack/react-query-devtools": "^5.91.3",
5863
"@tanstack/router-devtools": "^1.159.5",
@@ -65,6 +70,8 @@
6570
"eslint-plugin-react-hooks": "^7.0.1",
6671
"eslint-plugin-react-refresh": "^0.4.24",
6772
"globals": "^16.5.0",
73+
"msw": "^2.13.2",
74+
"msw-storybook-addon": "^2.0.7",
6875
"tsx": "^4.21.0",
6976
"typescript": "~5.9.3",
7077
"typescript-eslint": "^8.48.0",

0 commit comments

Comments
 (0)