frontend/ci: Build-Hinweis in die App-Quelle, env-gesteuert; Prod-Build ohne
Der Latest-Build-Hinweis wandert vom Workflow-sed in die App (app.js, mountBuildBadge), damit ihn auch der Dev-Server zeigt — ein Post-Build-sed erreicht den Dev-Server nicht. Logik umgekehrt: Hinweis ist der Normalfall, nur die produktive Installation schaltet ihn ab. Drei Zustaende ueber Vite-Env VITE_BUILD_BADGE (Auswertung in app.js): - Dev-Server (import.meta.env.DEV) -> 🔧 "Vorschau/lokaler Entwicklungsstand" - Default `npm run build` (Env ungesetzt) -> 🚧 "latest build"; der Pages- Deploy nutzt den Default und traegt den Hinweis dadurch automatisch (die sed-Injektion entfaellt). - `npm run build:prod` (Vite-Modus prod, .env.prod: VITE_BUILD_BADGE=none) -> KEIN Badge; esbuild eliminiert den Zweig als toten Code. Verifiziert zur Laufzeit (Dev + `vite preview` auf beiden Builds): 🔧 im Dev, 🚧 im Default-Build, gar nichts im Prod-Build (Titel sauber "Werkbaum"). 34 Vitest-Tests gruen, Workflow-YAML/Shell gueltig. Doku: D16 fortgeschrieben (quellbasiert/env statt sed, Begruendung); README (de/en) mit Prod-Build-Anleitung inkl. LICENSE-/Versions-Caveats; frontend/ CLAUDE.md; .claude/launch.json bekommt einen frontend-dist-Preview (vite preview, Port 8138) zum Verifizieren gebauter Dateien. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b7bf9182ea
commit
0f27bab905
@@ -55,6 +55,35 @@ npm run build # -> frontend/dist/index.html (single self-contained file)
|
||||
The built `dist/index.html` inlines all JS, CSS and the favicon, so **that** file
|
||||
does open standalone via `file://` and is what gets deployed.
|
||||
|
||||
### Build hint & your own production install
|
||||
|
||||
Non-production builds carry a small hint next to the title (symbol + tooltip) so
|
||||
it's clear this is **not** the stable instance:
|
||||
|
||||
- **Dev server** (`npm run dev`) → 🔧 "Preview – local development build"
|
||||
- **Default build** (`npm run build`, incl. the GitHub Pages deploy) → 🚧
|
||||
"Latest build – may still be buggy"
|
||||
|
||||
For **your own production install** the hint is switched off:
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm ci # or: npm install
|
||||
npm run build:prod # -> frontend/dist/index.html WITHOUT the hint
|
||||
```
|
||||
|
||||
`build:prod` runs Vite in mode `prod`; `frontend/.env.prod` sets
|
||||
`VITE_BUILD_BADGE=none`, so the badge code is tree-shaken away entirely (it isn't
|
||||
even present in the output source). Drop the resulting `dist/index.html` onto your
|
||||
web space/server (standalone, `file://`-capable). Details: `app.js`
|
||||
(`mountBuildBadge`), `docs/DECISIONS.md` D16.
|
||||
|
||||
Two things otherwise handled only by the Pages workflow, to fix up yourself when
|
||||
self-hosting: the footer **MIT-License** link is relative to `../LICENSE` (place
|
||||
that file one level above `index.html`, or adjust the link), and the **version
|
||||
number** stays the source placeholder `1.0` (the workflow otherwise replaces it
|
||||
from `VERSION` + commit count).
|
||||
|
||||
## Project documents
|
||||
|
||||
- `frontend/` — editor · `backend/` — Kotlin/Spring (scaffold to follow, see backend/README.md)
|
||||
|
||||
Reference in New Issue
Block a user