Skip to content

Commit fee8464

Browse files
authored
feat: expose generic SvgRenderer (#54)
Also migrate to Storybook 9 / CSF3.
1 parent 4d2bd03 commit fee8464

29 files changed

+1766
-461
lines changed

.github/workflows/storybook.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Storybook Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
container:
13+
# Make sure to grab the latest version of the Playwright image
14+
# https://playwright.dev/docs/docker#pull-the-image
15+
image: mcr.microsoft.com/playwright:v1.55.0
16+
steps:
17+
- uses: actions/checkout@v5
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version-file: 'package.json'
21+
- name: Install dependencies
22+
run: npm install
23+
- name: Run tests
24+
run: npm run test-storybook

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

.storybook/main.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
export default {
22
stories: ['../stories/**/*.stories.tsx'],
33

4-
addons: [
5-
'@storybook/addon-storysource',
6-
'@storybook/addon-links',
7-
'@storybook/addon-essentials',
8-
],
4+
addons: ['@storybook/addon-vitest'],
95

106
framework: {
117
name: '@storybook/react-vite',

.storybook/vitest.setup.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { setProjectAnnotations } from '@storybook/react-vite';
2+
3+
// This is an important step to apply the right configuration when testing your stories.
4+
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
5+
setProjectAnnotations([]);

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ts from 'eslint-config-cheminfo-typescript';
44
import storybook from 'eslint-plugin-storybook';
55

66
export default defineConfig(
7-
globalIgnores(['lib']),
7+
globalIgnores(['coverage', 'lib']),
88
ts,
99
react,
1010
storybook.configs['flat/recommended'],

package.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
"prepack": "npm run tsc",
2929
"prettier": "prettier --check .",
3030
"prettier-write": "prettier --write .",
31-
"test": "npm run test-only && npm run check-types && npm run eslint && npm run prettier",
32-
"test-only": "vitest run",
31+
"test": "npm run test-only && npm run test-storybook && npm run check-types && npm run eslint && npm run prettier",
32+
"test-only": "vitest run --project=unit --coverage",
33+
"test-storybook": "vitest run --project=storybook",
3334
"tsc": "npm run clean && npm run tsc-build",
3435
"tsc-build": "tsc -p tsconfig.build.json"
3536
},
@@ -39,28 +40,28 @@
3940
"react-dom": ">=18"
4041
},
4142
"devDependencies": {
42-
"@storybook/addon-essentials": "^8.6.12",
43-
"@storybook/addon-links": "^8.6.12",
44-
"@storybook/addon-storysource": "^8.6.12",
45-
"@storybook/react": "^8.6.12",
46-
"@storybook/react-vite": "^8.6.12",
47-
"@types/react": "^18.3.20",
48-
"@types/react-test-renderer": "^18.3.0",
49-
"@vitejs/plugin-react": "^4.4.0",
43+
"@storybook/addon-vitest": "^9.1.2",
44+
"@storybook/react-vite": "^9.1.2",
45+
"@types/node": "^24.3.0",
46+
"@types/react": "^19.1.10",
47+
"@vitejs/plugin-react": "^5.0.1",
48+
"@vitest/browser": "^3.2.4",
49+
"@vitest/coverage-v8": "^3.2.4",
5050
"@zakodium/tsconfig": "^1.0.2",
5151
"eslint": "^9.33.0",
5252
"eslint-config-cheminfo-react": "^17.0.1",
5353
"eslint-config-cheminfo-typescript": "^19.0.0",
54-
"eslint-plugin-storybook": "^0.12.0",
54+
"eslint-plugin-storybook": "^9.1.2",
55+
"jsdom": "^26.1.0",
5556
"openchemlib": "^9.7.0",
57+
"playwright": "^1.55.0",
5658
"prettier": "^3.6.2",
57-
"react": "^18.3.1",
58-
"react-dom": "^18.3.1",
59-
"react-test-renderer": "^18.3.1",
59+
"react": "^19.1.1",
60+
"react-dom": "^19.1.1",
6061
"rimraf": "^6.0.1",
61-
"storybook": "^8.6.12",
62+
"storybook": "^9.1.2",
6263
"typescript": "^5.9.2",
63-
"vite": "^6.3.1",
64+
"vite": "^7.1.3",
6465
"vitest": "^3.2.4"
6566
},
6667
"repository": {
@@ -70,6 +71,6 @@
7071
"bugs": "https://github.com/zakodium-oss/react-ocl/issues",
7172
"homepage": "https://github.com/zakodium-oss/react-ocl#readme",
7273
"volta": {
73-
"node": "22.14.0"
74+
"node": "24.6.0"
7475
}
7576
}

src/components/__tests__/__snapshots__/svg_renderer.test.tsx.snap

Lines changed: 0 additions & 205 deletions
This file was deleted.

0 commit comments

Comments
 (0)