Skip to content

Commit 0cae64f

Browse files
authored
Merge pull request #458 from objectstack-ai/copilot/fix-storybook-errors
2 parents c8aaa6c + 9246c84 commit 0cae64f

2 files changed

Lines changed: 88 additions & 4 deletions

File tree

.github/workflows/storybook-tests.yml

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,76 @@ on:
55
pull_request:
66
branches: [main, develop]
77

8+
permissions:
9+
contents: read
10+
811
jobs:
9-
test-storybook:
10-
timeout-minutes: 60
12+
storybook-build:
13+
name: Storybook Build
14+
timeout-minutes: 30
1115
runs-on: ubuntu-latest
16+
1217
steps:
1318
- uses: actions/checkout@v6
19+
20+
- name: Setup pnpm
21+
uses: pnpm/action-setup@v4
22+
1423
- uses: actions/setup-node@v6
1524
with:
1625
node-version: '20'
26+
cache: 'pnpm'
27+
28+
- name: Turbo Cache
29+
uses: actions/cache@v5
30+
with:
31+
path: node_modules/.cache/turbo
32+
key: turbo-${{ runner.os }}-${{ github.sha }}
33+
restore-keys: |
34+
turbo-${{ runner.os }}-
35+
36+
- name: Install dependencies
37+
run: pnpm install --frozen-lockfile
38+
39+
- name: Build packages
40+
run: pnpm build
41+
42+
- name: Build Storybook
43+
run: pnpm storybook:build
44+
45+
storybook-test:
46+
name: Storybook Test Runner
47+
timeout-minutes: 60
48+
runs-on: ubuntu-latest
49+
needs: storybook-build
50+
51+
steps:
52+
- uses: actions/checkout@v6
53+
1754
- name: Setup pnpm
1855
uses: pnpm/action-setup@v4
56+
57+
- uses: actions/setup-node@v6
58+
with:
59+
node-version: '20'
60+
cache: 'pnpm'
61+
62+
- name: Turbo Cache
63+
uses: actions/cache@v5
64+
with:
65+
path: node_modules/.cache/turbo
66+
key: turbo-${{ runner.os }}-${{ github.sha }}
67+
restore-keys: |
68+
turbo-${{ runner.os }}-
69+
1970
- name: Install dependencies
20-
run: pnpm install
71+
run: pnpm install --frozen-lockfile
72+
73+
- name: Build packages
74+
run: pnpm build
75+
2176
- name: Install Playwright Browsers
22-
run: pnpm exec playwright install --with-deps
77+
run: pnpm exec playwright install --with-deps chromium
78+
2379
- name: Run Storybook tests
2480
run: pnpm storybook:ci

.storybook/main.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { StorybookConfig } from "@storybook/react-vite";
22
import { mergeConfig } from 'vite';
33
import path from 'path';
4+
import { viteCryptoStub } from '../scripts/vite-crypto-stub';
45

56
const config: StorybookConfig = {
67
stories: ["../packages/**/src/**/*.mdx", "../packages/**/src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
@@ -19,6 +20,14 @@ const config: StorybookConfig = {
1920
},
2021
async viteFinal(config) {
2122
return mergeConfig(config, {
23+
define: {
24+
'process.env': {},
25+
'process.platform': '"browser"',
26+
'process.version': '"0.0.0"',
27+
},
28+
plugins: [
29+
viteCryptoStub(),
30+
],
2231
resolve: {
2332
alias: {
2433
// Alias for .storybook directory to allow imports from stories
@@ -52,6 +61,25 @@ const config: StorybookConfig = {
5261
'@object-ui/plugin-view': path.resolve(__dirname, '../packages/plugin-view/src/index.tsx'),
5362
},
5463
},
64+
optimizeDeps: {
65+
include: [
66+
'msw',
67+
'msw/browser',
68+
'@objectstack/spec',
69+
'@objectstack/spec/data',
70+
'@objectstack/spec/system',
71+
'@objectstack/spec/ui',
72+
'@objectstack/runtime',
73+
'@objectstack/objectql',
74+
'@objectstack/driver-memory',
75+
'@objectstack/plugin-msw',
76+
'@mdx-js/react',
77+
'react-router-dom',
78+
],
79+
},
80+
build: {
81+
target: 'esnext',
82+
},
5583
});
5684
},
5785
};

0 commit comments

Comments
 (0)