Skip to content

Commit e46dadd

Browse files
ZyieGregVGWAnna Spysz
authored
breaking: storybook v8 and vite support (#22)
Co-authored-by: GregVGW <[email protected]> Co-authored-by: Anna Spysz <[email protected]>
1 parent d3e16da commit e46dadd

31 files changed

+4140
-4094
lines changed

.github/workflows/testing.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Testing
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Use Node.js
11+
uses: actions/setup-node@v4
12+
with:
13+
node-version: "20"
14+
- run: npm ci
15+
- run: npm run build

README.md

+36-23
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,27 @@ to initialize with the html framework and manually edit the configuration:
1717

1818
```sh
1919
cd my-app
20-
npx storybook@"~7.0.0-beta" init -t html
20+
npx storybook@"~8.0.0" init -t html
2121
```
2222

23-
Remove HTML framework/renderer and install PixiJS framework/renderer:
23+
Remove HTML framework/renderer and install PixiJS framework/renderer based on your bunder:
2424

2525
```sh
2626
npm remove @storybook/html @storybook/html-webpack5 --save-dev
27+
```
28+
29+
```
2730
npm install @pixi/storybook-renderer @pixi/storybook-webpack5 --save-dev
2831
```
32+
_or_
33+
```
34+
npm install @pixi/storybook-renderer @pixi/storybook-vite --save-dev
35+
```
2936

3037
Replace `.storybook/main.js` with the below, setting up the correct paths as necessary.
3138

3239
```javascript
33-
module.exports = {
40+
const config = {
3441
// use glob matching, eg: ../src/stories/**/*.stories.@(ts|tsx|js|jsx|mdx)
3542
stories: ['RELATIVE_PATH_TO_STORIES'],
3643
staticDirs: ['RELATIVE_PATH_TO_ASSETS'],
@@ -51,35 +58,41 @@ module.exports = {
5158
buildStoriesJson: true,
5259
breakingChangesV7: true,
5360
},
54-
framework: '@pixi/storybook-webpack5',
61+
framework: '@pixi/storybook-webpack5', // or '@pixi/storybook-vite'
5562
};
63+
64+
export default config;
5665
```
5766

5867
Replace `.storybook/preview.js` with:
5968

6069
```javascript
61-
export const parameters = {
62-
layout: 'fullscreen',
63-
pixi: {
64-
// these are passed as options to `PIXI.Application` when instantiated by the
65-
// renderer
66-
applicationOptions: {
67-
backgroundColor: 0x1099bb,
68-
resolution: 1,
69-
},
70-
// optional, if you want to provide custom resize logic, pass a function here,
71-
// if nothing is provided, the default resize function is used, which looks like
72-
// this, where w and h will be the width and height of the storybook canvas.
73-
resizeFn: (w, h) => {
74-
return {
75-
rendererWidth: w,
76-
rendererHeight: h,
77-
canvasWidth: w,
78-
canvasHeight: h,
79-
};
70+
const preview = {
71+
parameters: {
72+
layout: 'fullscreen',
73+
pixi: {
74+
// these are passed as options to `PIXI.Application` when instantiated by the
75+
// renderer
76+
applicationOptions: {
77+
backgroundColor: 0x1099bb,
78+
resolution: 1,
79+
},
80+
// optional, if you want to provide custom resize logic, pass a function here,
81+
// if nothing is provided, the default resize function is used, which looks like
82+
// this, where w and h will be the width and height of the storybook canvas.
83+
resizeFn: (w, h) => {
84+
return {
85+
rendererWidth: w,
86+
rendererHeight: h,
87+
canvasWidth: w,
88+
canvasHeight: h,
89+
};
90+
},
8091
},
8192
},
8293
};
94+
95+
export default preview;
8396
```
8497

8598
Depending on where you want to keep your story source, either delete `src/stories` folder

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"useWorkspaces": true,
4-
"version": "0.1.0"
4+
"version": "1.0.0-alpha.0"
55
}

0 commit comments

Comments
 (0)