Skip to content

Commit de84d84

Browse files
authored
Feature/storybook deploy (#15)
* Upgraded Storybook to v8 * Fixed deployment of Storybook including static files
1 parent 8540b59 commit de84d84

File tree

7 files changed

+1978
-3885
lines changed

7 files changed

+1978
-3885
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/deploy-storybook.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ permissions:
1818
pages: write
1919
id-token: write
2020

21+
env:
22+
VITE_GH_PAGE: true
23+
2124
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2225
jobs:
2326
# This workflow contains a single job called "build"
@@ -27,10 +30,10 @@ jobs:
2730

2831
# Steps represent a sequence of tasks that will be executed as part of the job
2932
steps:
30-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3134

3235
# Set up Node
33-
- uses: actions/setup-node@v3
36+
- uses: actions/setup-node@v4
3437
with:
3538
node-version: '20.x'
3639

.storybook/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const config: StorybookConfig = {
55
addons: [
66
'@storybook/addon-links',
77
'@storybook/addon-essentials',
8-
'@storybook/addon-onboarding',
98
'@storybook/addon-storysource'
109
],
1110
framework: {

package-lock.json

Lines changed: 1951 additions & 3870 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build": "rollup -c && npm run emit-declarations",
1111
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1212
"start:storybook": "storybook dev -p 6006",
13-
"build:storybook": "storybook build --static-dir react-drawio"
13+
"build:storybook": "storybook build"
1414
},
1515
"repository": {
1616
"type": "git",
@@ -32,15 +32,14 @@
3232
},
3333
"devDependencies": {
3434
"@rollup/plugin-node-resolve": "^15.2.1",
35-
"@storybook/addon-essentials": "^7.3.2",
36-
"@storybook/addon-interactions": "^7.3.2",
37-
"@storybook/addon-links": "^7.3.2",
35+
"@storybook/addon-essentials": "^8.0.0",
36+
"@storybook/addon-interactions": "^8.0.0",
37+
"@storybook/addon-links": "^8.0.0",
3838
"@storybook/addon-storysource": "^8.0.0",
39-
"@storybook/blocks": "^7.3.2",
40-
"@storybook/builder-vite": "^7.3.2",
41-
"@storybook/react": "^7.3.2",
42-
"@storybook/react-vite": "^7.3.2",
43-
"@storybook/testing-library": "^0.2.0",
39+
"@storybook/blocks": "^8.0.0",
40+
"@storybook/react": "^8.0.0",
41+
"@storybook/react-vite": "^8.0.0",
42+
"@storybook/test": "^8.0.0",
4443
"@types/react": "^18.2.15",
4544
"@types/react-dom": "^18.2.7",
4645
"@typescript-eslint/eslint-plugin": "^6.0.0",
@@ -50,14 +49,14 @@
5049
"eslint": "^8.45.0",
5150
"eslint-plugin-react-hooks": "^4.6.0",
5251
"eslint-plugin-react-refresh": "^0.4.3",
53-
"eslint-plugin-storybook": "^0.6.13",
52+
"eslint-plugin-storybook": "^0.8.0",
5453
"react": "^18.2.0",
5554
"react-dom": "^18.2.0",
5655
"rollup": "^3.28.1",
5756
"rollup-plugin-delete": "^2.0.0",
5857
"rollup-plugin-import-css": "^3.3.1",
5958
"rollup-plugin-swc3": "^0.10.1",
60-
"storybook": "^7.3.2",
59+
"storybook": "^8.0.0",
6160
"typescript": "^5.0.2",
6261
"vite": "^4.4.5"
6362
},

stories/hooks/useRemoteFile.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ type UrlToBase64Options = {
44
isVisio?: boolean;
55
};
66

7+
const basePath = import.meta.env.VITE_GH_PAGE === 'true' ? '/react-drawio' : '';
8+
79
export const useRemoteFile = () => {
810
const [inputXml, setInputXml] = useState<string>('');
911

1012
const urlToBase64 = async (url: string, options?: UrlToBase64Options) => {
11-
const data = await fetch(url);
13+
const data = await fetch(`${basePath}${url}`);
1214

1315
if (data) {
1416
const blob = await data.blob();

vite-env.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference types="vite/client" />
2+
3+
interface ImportMetaEnv {
4+
readonly VITE_GH_PAGE: string
5+
}
6+
7+
interface ImportMeta {
8+
readonly env: ImportMetaEnv
9+
}

0 commit comments

Comments
 (0)