From ce13639c5e772ebe3cc1a58c4faaf7c3cfa9489b Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Wed, 9 Sep 2026 09:44:26 +0200 Subject: [PATCH] fix: :mag: use vite app name env in title page --- .gitlab-ci.yml | 2 ++ manifest.yaml | 1 + resources/ts/app.tsx | 4 +++- resources/ts/front/Pages/Home.tsx | 2 +- resources/ts/ssr.tsx | 5 ++++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99fec4d..a3462e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,6 +47,8 @@ frontend_build: paths: - node_modules/ policy: pull-push + variables: + VITE_APP_NAME: "${APP_APP_NAME}" before_script: - npm config set @ldc-web:registry https://lab.s-web.fr/api/v4/packages/npm/ - npm config set -- '//lab.s-web.fr/api/v4/packages/npm/:_authToken' "${GITLAB_PASSWORD}" diff --git a/manifest.yaml b/manifest.yaml index 4e37098..5602d1d 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -11,6 +11,7 @@ data: LOG_CHANNEL: "k8s" SENTRY_LARAVEL_DSN: "${APP_SENTRY_LARAVEL_DSN}" MATOMO_SITE_ID: "${APP_MATOMO_SITE_ID}" + VITE_APP_NAME: "${APP_APP_NAME}" --- apiVersion: v1 kind: PersistentVolumeClaim diff --git a/resources/ts/app.tsx b/resources/ts/app.tsx index 5c6d2fc..1cbe9d9 100644 --- a/resources/ts/app.tsx +++ b/resources/ts/app.tsx @@ -10,10 +10,12 @@ interface PageModule { default: PageComponent; } +const appName: string = (import.meta.env as Record) + .VITE_APP_NAME; const appPages = import.meta.glob("./*/Pages/**/*.tsx"); void createInertiaApp({ - title: (title) => title, + title: (title) => `${title} - ${appName}`, resolve: async (name) => { const page = await resolvePageComponent( `./${name}.tsx`, diff --git a/resources/ts/front/Pages/Home.tsx b/resources/ts/front/Pages/Home.tsx index 3d9943f..7861e31 100644 --- a/resources/ts/front/Pages/Home.tsx +++ b/resources/ts/front/Pages/Home.tsx @@ -20,7 +20,7 @@ export default function Home() { return ( <> diff --git a/resources/ts/ssr.tsx b/resources/ts/ssr.tsx index 3ece327..410de49 100644 --- a/resources/ts/ssr.tsx +++ b/resources/ts/ssr.tsx @@ -20,12 +20,15 @@ interface PageModule { default: PageComponent; } +const appName: string = (import.meta.env as Record) + .VITE_APP_NAME; + const appPages = import.meta.glob("./front/Pages/**/*.tsx"); createServer((page) => createInertiaApp({ page, - title: (title) => title, + title: (title) => `${title} - ${appName}`, render: ReactDOMServer.renderToString, resolve: async (name) => { const pageModule = await resolvePageComponent(