From 3e84d84bf1ff996b6f07956f18c694d2bfd98e7c Mon Sep 17 00:00:00 2001 From: Padreug Date: Tue, 9 Jun 2026 20:00:10 +0200 Subject: [PATCH] refactor(events): conditional brand in console label, tighten docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the standalone events app: - Add `APP_LABEL` next to `APP_NAME` in `events-app/app.ts`. It reads as `Events` on unbranded builds and `Events (Bouge)` (etc.) when `VITE_APP_NAME` is set to anything other than "Events" (case-insensitive). The four console messages (Starting / initialized / started / Failed to start) all use APP_LABEL, so unbranded dev doesn't show the redundant `Events (Events)`. `acceptTokenFromUrl` keeps the raw `APP_NAME` — it's a cross-subdomain token namespace identifier, not display copy. - `vite.events.config.ts` doc-comment: collapse the redundant "cfaun sets X; future deployments can override (e.g. X)" into the shorter "cfaun overrides to 'Bouge' via NixOS. Defaults to 'Events'." The override mechanism is the same, and the example was duplicating the value pointlessly. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/events-app/app.ts | 11 +++++++---- vite.events.config.ts | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/events-app/app.ts b/src/events-app/app.ts index 05db852..4e6963f 100644 --- a/src/events-app/app.ts +++ b/src/events-app/app.ts @@ -17,12 +17,15 @@ import { installLenientAuthGuard, markAuthReady, catchAllRoute } from '@/lib/rou import { acceptTokenFromUrl } from '@/lib/url-token' const APP_NAME = (import.meta.env.VITE_APP_NAME as string) || 'Events' +// Console label shows the brand in parens only when it differs from the +// default — avoids the redundant "Events (Events)" on unbranded builds. +const APP_LABEL = APP_NAME.toLowerCase() === 'events' ? 'Events' : `Events (${APP_NAME})` /** * Initialize the standalone events app */ export async function createAppInstance() { - console.log(`🚀 Starting ${APP_NAME}...`) + console.log(`🚀 Starting ${APP_LABEL}...`) // Accept token from URL before anything else (cross-subdomain auth relay) acceptTokenFromUrl(APP_NAME) @@ -116,7 +119,7 @@ export async function createAppInstance() { ;(window as any).__container = container } - console.log(`✅ ${APP_NAME} initialized`) + console.log(`✅ ${APP_LABEL} initialized`) return { app, router } } @@ -124,10 +127,10 @@ export async function startApp() { try { const { app } = await createAppInstance() app.mount('#app') - console.log(`🎉 ${APP_NAME} started!`) + console.log(`🎉 ${APP_LABEL} started!`) eventBus.emit('app:started', {}, 'app') } catch (error) { - console.error(`💥 Failed to start ${APP_NAME}:`, error) + console.error(`💥 Failed to start ${APP_LABEL}:`, error) document.getElementById('app')!.innerHTML = `

Failed to Start

diff --git a/vite.events.config.ts b/vite.events.config.ts index 418bb35..76c2c31 100644 --- a/vite.events.config.ts +++ b/vite.events.config.ts @@ -42,8 +42,7 @@ function eventsHtmlPlugin(): Plugin { * (default: /) → bouge.ariege.io (standalone subdomain) * * Set VITE_APP_NAME to brand the standalone (PWA name, HTML title, console - * logs). cfaun sets "Bouge" via NixOS; future deployments can override - * (e.g. "Bouge"). Defaults to "Events". + * logs). cfaun overrides to "Bouge" via NixOS. Defaults to "Events". */ const APP_NAME = process.env.VITE_APP_NAME || 'Events' // Surface the resolved value back into env so Vite's HTML %VITE_APP_NAME%