From 5c0219d006676eb2eb8e1fd0504e6c7ab5edddc0 Mon Sep 17 00:00:00 2001 From: Bram-Zijp Date: Sun, 3 Mar 2024 16:23:03 +0100 Subject: [PATCH] docs: ensure github pages have proper base --- .github/workflows/deploy-static-github-pages.yml | 2 +- .github/workflows/quality-assurance.yml | 3 --- apps/storybook/.storybook/main.ts | 4 ++-- apps/storybook/src/examples/ProductPage.stories.tsx | 3 +++ apps/storybook/src/test-utils/dashboardSetup.ts | 4 +++- apps/storybook/vite.config.ts | 1 - nx.json | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-static-github-pages.yml b/.github/workflows/deploy-static-github-pages.yml index 054df0b1..4b900972 100644 --- a/.github/workflows/deploy-static-github-pages.yml +++ b/.github/workflows/deploy-static-github-pages.yml @@ -43,7 +43,7 @@ jobs: run: npx nx run-many -t build -p storybook env: STORYBOOK_PREVIEW: true - STORYBOOK_PUBLIC_PATH: /dynamic-msw/ + VITE_STORYBOOK_PUBLIC_PATH: /dynamic-msw/ NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/.github/workflows/quality-assurance.yml b/.github/workflows/quality-assurance.yml index 38ebc44e..241410e5 100644 --- a/.github/workflows/quality-assurance.yml +++ b/.github/workflows/quality-assurance.yml @@ -5,10 +5,7 @@ concurrency: cancel-in-progress: true on: - pull_request: push: - branches: - - main jobs: quality-assurance: diff --git a/apps/storybook/.storybook/main.ts b/apps/storybook/.storybook/main.ts index e07521a6..5ae0d971 100644 --- a/apps/storybook/.storybook/main.ts +++ b/apps/storybook/.storybook/main.ts @@ -13,8 +13,8 @@ const config: StorybookConfig = { }, }, managerHead: (head) => { - if (!process.env.STORYBOOK_PUBLIC_PATH) return head; - return `${head}`; + if (!process.env.VITE_STORYBOOK_PUBLIC_PATH) return head; + return `${head}`; }, viteFinal: (viteConfig) => mergeConfig(viteConfig, { diff --git a/apps/storybook/src/examples/ProductPage.stories.tsx b/apps/storybook/src/examples/ProductPage.stories.tsx index 8fbe2682..2c3c0add 100644 --- a/apps/storybook/src/examples/ProductPage.stories.tsx +++ b/apps/storybook/src/examples/ProductPage.stories.tsx @@ -3,6 +3,9 @@ import ProductPage from './ProductPage'; const meta: Meta = { component: ProductPage, + parameters: { + layout: 'fullscreen', + }, }; export default meta; diff --git a/apps/storybook/src/test-utils/dashboardSetup.ts b/apps/storybook/src/test-utils/dashboardSetup.ts index 66b02404..24772ed4 100644 --- a/apps/storybook/src/test-utils/dashboardSetup.ts +++ b/apps/storybook/src/test-utils/dashboardSetup.ts @@ -15,4 +15,6 @@ const setup = setupDashboard( renderDashboardButton: true, // true by default } ); -await setup.start({ onUnhandledRequest: 'bypass' }); +await setup.start({ + onUnhandledRequest: 'bypass', +}); diff --git a/apps/storybook/vite.config.ts b/apps/storybook/vite.config.ts index 2df3d2c3..2563487d 100644 --- a/apps/storybook/vite.config.ts +++ b/apps/storybook/vite.config.ts @@ -10,7 +10,6 @@ process.env.VITE_DASHBOARD_HTML = getDashboardHTML(); export default defineConfig({ root: __dirname, cacheDir: '../../node_modules/.vite/apps/storybook', - base: process.env.STORYBOOK_PUBLIC_PATH || '/', server: { port: 4200, host: 'localhost', diff --git a/nx.json b/nx.json index e9fe4ded..bda85bc5 100644 --- a/nx.json +++ b/nx.json @@ -98,7 +98,7 @@ "@nx/storybook:build": { "cache": true, "dependsOn": ["^build"], - "inputs": ["storybook"] + "inputs": ["storybook", { "runtime": "echo $VITE_STORYBOOK_PUBLIC_PATH" }] }, "@nx/storybook:serve": { "cache": true,