Skip to content

Commit

Permalink
[F] storybook deploy setup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed May 16, 2024
1 parent e2ad5eb commit 23474b5
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Run Jest unit tests
on:
pull_request:
branches: [main, develop]
branches: [develop]
jobs:
build:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ on:
- "main" # Replace with the branch you want to deploy from

permissions:
contents: read
pages: write
id-token: write
contents: write

# List of jobs
jobs:
Expand All @@ -24,19 +22,16 @@ jobs:
steps:
# Manual Checkout
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
uses: Borales/actions-yarn@v5.0.0
with:
cmd: install # will run `yarn install` command
#👇 Add Storybook build and deploy to GitHub Pages as a step in the workflow
- uses: bitovi/github-[email protected]
run: yarn --frozen-lockfile
- name: Build Storybook
run: yarn deploy-storybook
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
install_command: yarn install # default: npm ci
build_command: yarn build-storybook # default: npm run build-storybook
path: storybook-static # default: dist/storybook
checkout: false # default: true
folder: storybook-static # The folder the action should deploy.
token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "0.6.0",
"version": "0.7.0",
"license": "MIT",
"author": "Rubin EPO",
"repository": {
Expand All @@ -15,12 +15,9 @@
"packages/epo-style-dictionary"
],
"scripts": {
"build-storybook": "yarn workspace @rubin-epo/epo-react-lib run build-storybook -o ../../storybook-static && yarn workspace @rubin-epo/epo-widget-lib run build-storybook -o ../../storybook-static/epo-widget-lib",
"deploy-storybook": "mkdir ./storybook-static && touch ./storybook-static/.nojekyll && storybook-to-ghpages --packages=packages --out=.out",
"build-storybook:production": "yarn workspace @rubin-epo/epo-react-lib run build-storybook:production && yarn workspace @rubin-epo/epo-widget-lib run build-storybook:production",
"test": "yarn workspaces run test",
"test:generate-output": "jest --json --outputFile=.jest-test-results.json || true"
},
"devDependencies": {
"@storybook/storybook-deployer": "^2.8.16"
}
"devDependencies": {}
}
1 change: 0 additions & 1 deletion packages/epo-react-lib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ tempPublish/
.out/*

# testing
.jest-test-results.json

# Editor directories and files
.vscode/*
Expand Down
1 change: 1 addition & 0 deletions packages/epo-react-lib/.jest-test-results.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion packages/epo-react-lib/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { mergeConfig } from "vite";
import { resolve, dirname, join } from "path";
import { StorybookConfig } from "@storybook/react-vite";
import react from "@vitejs/plugin-react";

const config: StorybookConfig = {
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
Expand All @@ -16,6 +17,9 @@ const config: StorybookConfig = {
options: {},
},
core: {},
typescript: {
reactDocgen: "react-docgen", // 👈 react-docgen configured here.
},
features: {
storyStoreV7: true,
},
Expand All @@ -37,8 +41,10 @@ const config: StorybookConfig = {
};
},
async viteFinal(config) {
config.plugins = config.plugins?.filter((p) => p?.name !== "vite:dts");

return mergeConfig(config, {
base: "/epo-react-lib/@rubin-epo/epo-react-lib/",
base: "/epo-react-lib/",
resolve: {
alias: {
path: "path-browserify",
Expand Down
5 changes: 3 additions & 2 deletions packages/epo-react-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"publish-clean": "yarn test && yarn build && clean-publish",
"publish-beta": "yarn build && clean-publish --tag beta",
"publish-local": "yarn build && clean-publish --without-publish",
"storybook": "yarn test:generate-output && storybook dev -p 6006",
"build-storybook": "yarn test:generate-output && storybook build",
"storybook": "yarn storybook dev -p 6006",
"build-storybook": "storybook build",
"build-storybook:production": "yarn build-storybook -o ../../storybook-static",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --max-workers=2",
"test:generate-output": "yarn test --json --outputFile=.jest-test-results.json || true"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Avoid using these
*
* Do not edit directly
* Generated on Wed, 15 May 2024 19:05:35 GMT
* Generated on Thu, 16 May 2024 22:19:26 GMT
*/

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Avoid using these
*
* Do not edit directly
* Generated on Wed, 15 May 2024 19:05:35 GMT
* Generated on Thu, 16 May 2024 22:19:26 GMT
*/

:root {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Avoid using these
*
* Do not edit directly
* Generated on Wed, 15 May 2024 19:05:35 GMT
* Generated on Thu, 16 May 2024 22:19:26 GMT
*/

export const white : string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Avoid using these
*
* Do not edit directly
* Generated on Wed, 15 May 2024 19:05:35 GMT
* Generated on Thu, 16 May 2024 22:19:26 GMT
*/

export const white = "#ffffff";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Avoid using these
*
* Do not edit directly
* Generated on Wed, 15 May 2024 19:05:35 GMT
* Generated on Thu, 16 May 2024 22:19:26 GMT
*/

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Avoid using these
*
* Do not edit directly
* Generated on Wed, 15 May 2024 19:05:35 GMT
* Generated on Thu, 16 May 2024 22:19:26 GMT
*/

export const FONT_WEIGHT_NORMAL : string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Avoid using these
*
* Do not edit directly
* Generated on Wed, 15 May 2024 19:05:35 GMT
* Generated on Thu, 16 May 2024 22:19:26 GMT
*/

export const FONT_WEIGHT_NORMAL = "400";
Expand Down
1 change: 0 additions & 1 deletion packages/epo-widget-lib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ tempPublish
.out/*

# testing
.jest-test-results.json

# Editor directories and files
.vscode/*
Expand Down
1 change: 1 addition & 0 deletions packages/epo-widget-lib/.jest-test-results.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion packages/epo-widget-lib/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ const config: StorybookConfig = {
};
},
async viteFinal(config) {
config.plugins = config.plugins?.filter((p) => p?.name !== "vite:dts");

return mergeConfig(config, {
base: "/epo-react-lib/@rubin-epo/epo-widget-lib/",
base: "/epo-react-lib/epo-widget-lib/",
resolve: {
alias: {
path: "path-browserify",
Expand Down
5 changes: 3 additions & 2 deletions packages/epo-widget-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"publish-clean": "yarn test && yarn build && clean-publish",
"publish-beta": "yarn build && clean-publish --tag beta",
"publish-local": "yarn build && clean-publish --without-publish",
"storybook": "yarn run test:generate-output && storybook dev -p 6007",
"build-storybook": "yarn test:generate-output && storybook build",
"storybook": "yarn storybook dev -p 6007",
"build-storybook": "storybook build",
"build-storybook:production": "yarn build-storybook -o ../../storybook-static",
"test": "jest --max-workers=2",
"test:generate-output": "yarn test --json --outputFile=.jest-test-results.json || true"
},
Expand Down

0 comments on commit 23474b5

Please sign in to comment.