Skip to content

Commit c56cfcf

Browse files
authored
chore/MIG-6862 Upload Storybook to Github Pages (#42)
* chore/MIG-6862 Upload Storybook to Github Pages * chore/MIG-6862 Remove Typescript resolution when building Storybook * chore/MIG-6862 Change to push to main * chore/MIG-6862 Update README with new changes
1 parent 3d491ec commit c56cfcf

File tree

6 files changed

+77
-5
lines changed

6 files changed

+77
-5
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Storybook
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Enable Corepack
11+
run: corepack enable
12+
shell: bash
13+
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version-file: .nvmrc
23+
cache: yarn
24+
cache-dependency-path: yarn.lock
25+
26+
- name: Install dependencies
27+
run: yarn install
28+
29+
- name: Build Storybook
30+
run: yarn build-storybook
31+
32+
- name: Deploy to GitHub Pages
33+
uses: peaceiris/actions-gh-pages@v3
34+
with:
35+
github_token: ${{ secrets.GITHUB_TOKEN }}
36+
publish_dir: ./storybook-static

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
.idea
33
.yarn
4-
dist
4+
dist
5+
storybook-static

.storybook/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { join, dirname } from 'path';
22

33
import type { StorybookConfig } from '@storybook/react-vite';
4+
import { withoutVitePlugins } from '@storybook/builder-vite';
45

56
/**
67
* This function is used to resolve the absolute path of a package.
@@ -9,6 +10,7 @@ import type { StorybookConfig } from '@storybook/react-vite';
910
function getAbsolutePath(value: string): any {
1011
return dirname(require.resolve(join(value, 'package.json')));
1112
}
13+
1214
const config: StorybookConfig = {
1315
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
1416
addons: [
@@ -21,5 +23,10 @@ const config: StorybookConfig = {
2123
name: getAbsolutePath('@storybook/react-vite'),
2224
options: {},
2325
},
26+
async viteFinal(config) {
27+
config.plugins = await withoutVitePlugins(config.plugins, ['vite:dts']);
28+
29+
return config;
30+
},
2431
};
2532
export default config;

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,17 @@ To run all tests:
6565
yarn test
6666
````
6767

68-
## Running Storybook Locally
69-
To explore components and their behavior in isolation:
68+
## Running Storybook
69+
To explore components and their behavior in isolation: https://mongodb-js.github.io/diagramming
70+
71+
Changes to the Storybook will be uploaded to the link above on push to `main`
72+
73+
To run locally at http://localhost:6006 on your own branch:
7074

7175
```bash
7276
yarn install
7377
yarn storybook
7478
```
75-
76-
Storybook will run locally at http://localhost:6006.
7779

7880
### Resources
7981
- [NPM Package](https://www.npmjs.com/package/@mongodb-js/diagramming)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@storybook/addon-essentials": "^8.6.0",
5858
"@storybook/addon-interactions": "^8.6.0",
5959
"@storybook/addon-themes": "^8.6.12",
60+
"@storybook/builder-vite": "^9.0.0",
6061
"@storybook/react": "^8.6.0",
6162
"@storybook/react-vite": "^8.6.0",
6263
"@storybook/test": "^8.6.0",

yarn.lock

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,7 @@ __metadata:
12611261
"@storybook/addon-essentials": "npm:^8.6.0"
12621262
"@storybook/addon-interactions": "npm:^8.6.0"
12631263
"@storybook/addon-themes": "npm:^8.6.12"
1264+
"@storybook/builder-vite": "npm:^9.0.0"
12641265
"@storybook/react": "npm:^8.6.0"
12651266
"@storybook/react-vite": "npm:^8.6.0"
12661267
"@storybook/test": "npm:^8.6.0"
@@ -1807,6 +1808,19 @@ __metadata:
18071808
languageName: node
18081809
linkType: hard
18091810

1811+
"@storybook/builder-vite@npm:^9.0.0":
1812+
version: 9.0.0
1813+
resolution: "@storybook/builder-vite@npm:9.0.0"
1814+
dependencies:
1815+
"@storybook/csf-plugin": "npm:9.0.0"
1816+
ts-dedent: "npm:^2.0.0"
1817+
peerDependencies:
1818+
storybook: ^9.0.0
1819+
vite: ^5.0.0 || ^6.0.0
1820+
checksum: 10c0/15cf155b5dc8b05abac7376e7c233e4c12c24bdf22f492c4072888081db49577633504501bb3ac0c7cebcdca642169a3bbc57154b77506ecdc946cd911ad82fa
1821+
languageName: node
1822+
linkType: hard
1823+
18101824
"@storybook/components@npm:8.6.0":
18111825
version: 8.6.0
18121826
resolution: "@storybook/components@npm:8.6.0"
@@ -1851,6 +1865,17 @@ __metadata:
18511865
languageName: node
18521866
linkType: hard
18531867

1868+
"@storybook/csf-plugin@npm:9.0.0":
1869+
version: 9.0.0
1870+
resolution: "@storybook/csf-plugin@npm:9.0.0"
1871+
dependencies:
1872+
unplugin: "npm:^1.3.1"
1873+
peerDependencies:
1874+
storybook: ^9.0.0
1875+
checksum: 10c0/601f7e8425952e8fe28093ee17af8803f34b3378e4b54e565c0cc41d98e9df2ef93cdcd4dcc36fa87d264ac38c9ac5d7bd1abd79e8895261e22cfa556fcbbd63
1876+
languageName: node
1877+
linkType: hard
1878+
18541879
"@storybook/csf@npm:^0.1.11":
18551880
version: 0.1.13
18561881
resolution: "@storybook/csf@npm:0.1.13"

0 commit comments

Comments
 (0)