From e9b58a62c0c8eb7510d94f0ce900cea7f352200f Mon Sep 17 00:00:00 2001 From: Julien Gautier Date: Mon, 11 May 2026 17:16:47 +0200 Subject: [PATCH] =?UTF-8?q?fix(ci):=20perf=20job=20=E2=80=94=20point=20Lig?= =?UTF-8?q?hthouse=20at=20/fr/=20and=20/en/,=20drop=20spa=20fallback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous PR enabled `--localize` on the production build, so the output structure became `dist/apps/portal-shell/browser/{en,fr}/` with no top-level `index.html`. Two CI breakages followed: - `nx run portal-shell:serve-static` (lhci's `startServerCommand`) was configured with `spa: true`. The `@nx/web:file-server` executor reads that as "copy `/index.html` to `404.html` for SPA fallback". The source file no longer exists, so the executor crashes with `ENOENT … copyfile … index.html` and never opens the port. - Even if the server had started, `lighthouserc.js` was targeting `http://localhost:4200/` which produces an `http-server` directory listing under the new layout. Lighthouse would have run against that, not the SPA. Fixes: - Drop `spa: true` from the `serve-static` target. The executor no longer attempts the missing copy. Deep-link fallback in production is the reverse proxy's job (it routes `/{en,fr}/anything` to the matching `index.html`); `nx serve-static` is only used for the perf gate and for local prod-build inspection of the entry points. For deep-link testing in dev, `nx serve` is the right tool. - Update `lighthouserc.js` `url` list to `['http://localhost:4200/fr/', 'http://localhost:4200/en/']`, matching the directive in ADR-0019 that both locales clear the same performance bar. --- apps/portal-shell/project.json | 3 +-- lighthouserc.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/portal-shell/project.json b/apps/portal-shell/project.json index 40ee8a6..9868da0 100644 --- a/apps/portal-shell/project.json +++ b/apps/portal-shell/project.json @@ -112,8 +112,7 @@ "options": { "buildTarget": "portal-shell:build", "port": 4200, - "staticFilePath": "dist/apps/portal-shell/browser", - "spa": true + "staticFilePath": "dist/apps/portal-shell/browser" } } } diff --git a/lighthouserc.js b/lighthouserc.js index d8a2575..0faf438 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -4,20 +4,23 @@ * Thresholds match the Google "Good" Core Web Vitals values plus the * Lighthouse Performance score floor we set as the project bar. * - * Critical-routes list grows as features land. v1 only checks the - * static-served portal-shell bundle (which today shows the Nx Welcome - * placeholder); meaningful per-route assertions land alongside the - * features that introduce those routes. + * Critical-routes list grows as features land. v1 checks the + * static-served portal-shell bundle on both locale entry points + * (`/fr/` is the default served at the production root via the smart + * redirect; `/en/` is the alternate). ADR-0019 mandates that both + * locales clear the same bar. Per-route assertions land alongside + * the features that introduce those routes. */ module.exports = { ci: { collect: { // Serve the production bundle statically (no BFF needed for v1 - // measurements). When real auth / routes exist, the URL list - // expands to the critical-routes list documented in ADR-0017. + // measurements). With `--localize` the build emits per-locale + // folders (`browser/en/`, `browser/fr/`); we serve their parent + // and Lighthouse hits each locale's root index.html directly. startServerCommand: 'pnpm nx run portal-shell:serve-static', startServerReadyPattern: 'Available on:', - url: ['http://localhost:4200/'], + url: ['http://localhost:4200/fr/', 'http://localhost:4200/en/'], numberOfRuns: 3, settings: { // Slow-4G profile so scores are stable across CI runners and