From 37cb75e27f97f3f258023216ebdf819ebdf5759c Mon Sep 17 00:00:00 2001 From: Sissoko Date: Mon, 18 Aug 2025 00:19:24 +0200 Subject: [PATCH 1/3] Update index.jsx --- src/pages/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 13f47b1..143efd3 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -12,7 +12,7 @@ import styles from './index.module.css' function Playground() { /* - WELCOME TO MONA's 😽🐙 PLAYGROUND + WELCOME TO DAVID's 😽🐙 PLAYGROUND Delete everything in here or play with the existing Mona playground code to get familiar with Primer React. Documentation: https://primer.style/product/getting-started/react/ Documentation vars: https://primer.style/primitives/ From e6c25ffc915133eb2ea5185c89978cb6f3aa35e1 Mon Sep 17 00:00:00 2001 From: Sissoko Date: Mon, 18 Aug 2025 00:19:53 +0200 Subject: [PATCH 2/3] Update index.jsx --- src/pages/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 143efd3..13f47b1 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -12,7 +12,7 @@ import styles from './index.module.css' function Playground() { /* - WELCOME TO DAVID's 😽🐙 PLAYGROUND + WELCOME TO MONA's 😽🐙 PLAYGROUND Delete everything in here or play with the existing Mona playground code to get familiar with Primer React. Documentation: https://primer.style/product/getting-started/react/ Documentation vars: https://primer.style/primitives/ From 0625549bcbe8a65dff6e90a7f6ad8d19320e94f0 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 18 Aug 2025 22:37:17 +0200 Subject: [PATCH 3/3] fix: Configure dynamic base path for universal deployment --- .github/workflows/deploy.yml | 9 +++++++++ public/404.html | 2 +- src/index.jsx | 6 ++++-- vite.config.js | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9420eba..3263113 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,9 @@ on: push: branches: - main + pull_request: + branches: + - main jobs: build: @@ -20,8 +23,14 @@ jobs: - name: Install dependencies run: npm ci --legacy-peer-deps + - name: Set Base URL + id: set_base_url + run: echo "base_url=/${{ github.event.repository.name }}/" >> $GITHUB_OUTPUT + - name: Build project run: npm run build + env: + VITE_BASE_URL: ${{ steps.set_base_url.outputs.base_url }} - name: Upload static files as artifact id: deployment diff --git a/public/404.html b/public/404.html index db6ca75..1773d5e 100644 --- a/public/404.html +++ b/public/404.html @@ -22,7 +22,7 @@ // https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes // https://username.github.io/repo-name/?/one/two&a=b~and~c=d#qwe // Otherwise, leave pathSegmentsToKeep as 0. - var pathSegmentsToKeep = 0; + var pathSegmentsToKeep = 1; var l = window.location; l.replace( diff --git a/src/index.jsx b/src/index.jsx index 8fb073a..c1d7472 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -1,6 +1,7 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' -import { Routes } from '@generouted/react-router' +import { createBrowserRouter, RouterProvider } from 'react-router-dom' +import { routes } from '@generouted/react-router' import { ThemeProvider, BaseStyles } from '@primer/react' import './reset.css' @@ -8,6 +9,7 @@ import './globals.css' import ColorModeSwitcher from './components/ColorModeSwitcher' +const router = createBrowserRouter(routes, { basename: import.meta.env.VITE_BASE_URL }) const rootElement = document.getElementById('root') const root = createRoot(rootElement) @@ -16,7 +18,7 @@ root.render( - + diff --git a/vite.config.js b/vite.config.js index bdde880..e1c0bca 100644 --- a/vite.config.js +++ b/vite.config.js @@ -7,6 +7,7 @@ import browsers from '@github/browserslist-config' import { globSync } from 'glob' export default defineConfig({ + base: process.env.VITE_BASE_URL || '/', plugins: [react(), generouted()], server: { port: 1234 }, css: {