Compare commits

..

5 commits

Author SHA1 Message Date
c0375db9f2 Merge pull request 'release/0.1.2' (#22) from release/0.1.2 into main
Reviewed-on: #22
2026-06-15 06:53:40 +00:00
AyoubBenziza
ea476da01e chore(release): 0.1.2
Optional Umami analytics (env-driven). See CHANGELOG.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 08:51:41 +02:00
89ce5e2c0b Merge pull request 'feat(web): optional Umami analytics (env-driven)' (#21) from feature/umami-analytics into dev
Reviewed-on: #21
2026-06-15 06:49:33 +00:00
AyoubBenziza
1bda0e122e feat(web): optional Umami analytics (env-driven)
- inject the Umami script at runtime only when VITE_UMAMI_SRC + VITE_UMAMI_WEBSITE_ID
  are set (so dev/local traffic isn't tracked); website-id is public, not a secret
- web Dockerfile passes them as build args; docker-compose.prod.yml + env examples
  document them (optional, empty = disabled)

Verified: build bakes the values in when set; skipped when unset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 08:40:35 +02:00
AyoubBenziza
0d79bf3fa6 Merge branch 'release/0.1.1' into dev 2026-06-12 12:37:26 +02:00
10 changed files with 47 additions and 4 deletions

View file

@ -4,6 +4,14 @@ Toutes les évolutions notables de NerdWare. Format basé sur
[Keep a Changelog](https://keepachangelog.com/fr/1.1.0/), versionné en
[SemVer](https://semver.org/lang/fr/).
## [0.1.2] — 2026-06-12
### Ajouté
- **Umami analytics** (optionnel) : suivi d'audience injecté seulement si
`VITE_UMAMI_SRC` + `VITE_UMAMI_WEBSITE_ID` sont définis au build (sinon désactivé,
pas de suivi en dev). L'ID de site est public, pas un secret.
## [0.1.1] — 2026-06-12
Correctifs et améliorations issus des premières parties entre amis.
@ -55,5 +63,6 @@ fin), trois modes, back-office et internationalisation.
- **Déploiement** : Dockerfiles (serveur Bun, client nginx) + `docker-compose.prod.yml`
prêt pour Dokploy.
[0.1.2]: https://git.ayoubbenziza.dev/ayoub/nerdware/src/tag/v0.1.2
[0.1.1]: https://git.ayoubbenziza.dev/ayoub/nerdware/src/tag/v0.1.1
[0.1.0]: https://git.ayoubbenziza.dev/ayoub/nerdware/src/tag/v0.1.0

View file

@ -1,6 +1,6 @@
{
"name": "@nerdware/server",
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"private": true,
"scripts": {

View file

@ -1 +1,5 @@
VITE_SERVER_URL=http://localhost:3001
# Umami analytics (optionnel, prod). Vide en dev = pas de suivi.
VITE_UMAMI_SRC=
VITE_UMAMI_WEBSITE_ID=

View file

@ -15,6 +15,11 @@ COPY apps/web apps/web
ARG VITE_SERVER_URL
ENV VITE_SERVER_URL=$VITE_SERVER_URL
# Umami analytics (optionnel) — figé au build.
ARG VITE_UMAMI_SRC
ENV VITE_UMAMI_SRC=$VITE_UMAMI_SRC
ARG VITE_UMAMI_WEBSITE_ID
ENV VITE_UMAMI_WEBSITE_ID=$VITE_UMAMI_WEBSITE_ID
RUN bun run --filter web build
FROM nginx:1.27-alpine AS runner

View file

@ -1,6 +1,6 @@
{
"name": "web",
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"private": true,
"scripts": {

View file

@ -0,0 +1,20 @@
// Umami analytics : on injecte le script seulement si les variables de build
// sont présentes (donc pas en dev → pas de trafic local dans les stats).
// L'ID de site est public (visible dans le HTML), ce n'est pas un secret.
const SRC = import.meta.env.VITE_UMAMI_SRC
const WEBSITE_ID = import.meta.env.VITE_UMAMI_WEBSITE_ID
export function initAnalytics(): void {
if (!SRC || !WEBSITE_ID) {
return
}
if (document.querySelector("script[data-website-id]")) {
return
}
const script = document.createElement("script")
script.defer = true
script.src = SRC
script.setAttribute("data-website-id", WEBSITE_ID)
document.head.appendChild(script)
}

View file

@ -6,6 +6,9 @@ import "@workspace/ui/globals.css"
import { App } from "./App.tsx"
import { ThemeProvider } from "@/components/theme-provider.tsx"
import { I18nProvider } from "@/i18n/provider"
import { initAnalytics } from "@/lib/analytics"
initAnalytics()
const queryClient = new QueryClient()

View file

@ -54,6 +54,8 @@ services:
dockerfile: apps/web/Dockerfile
args:
VITE_SERVER_URL: ${VITE_SERVER_URL}
VITE_UMAMI_SRC: ${VITE_UMAMI_SRC:-}
VITE_UMAMI_WEBSITE_ID: ${VITE_UMAMI_WEBSITE_ID:-}
restart: unless-stopped
depends_on:
- server

View file

@ -1,6 +1,6 @@
{
"name": "nerdware",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"scripts": {
"build": "turbo build",

View file

@ -1,6 +1,6 @@
{
"name": "@nerdware/shared",
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"private": true,
"scripts": {