refactor(events): rename activities module to events + wire VITE_APP_NAME for per-deployment branding #94

Merged
padreug merged 9 commits from refactor/events-module-rename into dev 2026-06-09 18:18:27 +00:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit 3e84d84bf1 - Show all commits

refactor(events): conditional brand in console label, tighten docs

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) <noreply@anthropic.com>
Padreug 2026-06-09 20:00:10 +02:00

View file

@ -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 = `
<div style="padding: 20px; text-align: center; color: red;">
<h1>Failed to Start</h1>

View file

@ -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%