Files
AndreaSlopFotografie/web/lighthouserc.cjs
T
SluijsensandClaude Opus 5.5 4d6408b607 Completes the front-end shell with footer, status pages and SEO
Adds the footer, back-to-top button, skip link, placeholder routes,
404 and error pages inside the shell, plus per-page SEO from a single
page registry (canonical URLs, Open Graph image, JSON-LD, generated
sitemap.xml and robots.txt).

Theme tokens and recipes replace repeated styling, the hero loads only
the active and neighbouring slides, and the e-mail address is joined
in the browser to keep it out of the HTML and bundle.

Adds Vitest with property-based (fast-check) and axe tests, ESLint,
security headers for dev and preview, Lighthouse CI and a `pnpm check`
script that runs all quality gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:05:02 +02:00

90 lines
2.9 KiB
JavaScript

// Lighthouse CI tegen de gebouwde site (`pnpm preview`), zodat de echte
// securityheaders en de SPA-fallback meetellen. Doelen: NFR-P-01, NFR-A-01,
// NFR-S-01/02. Dit is de mobiele meting; lighthouserc.desktop.cjs bouwt hierop
// voort voor desktop. `pnpm lighthouse` draait beide.
const origin = 'http://localhost:4173';
// Moet gelijk lopen met src/sitePages.ts (een test bewaakt dat)
const indexedPaths = ['/'];
const noindexPaths = [
'/over-mij',
'/portfolio',
'/soorten-fotoshoots',
'/contact',
'/privacyverklaring',
];
const notFoundPath = '/bestaat-niet';
// Homepage mobiel voorlopig 0,8: de foto's zijn nog niet responsive en de
// titel verschijnt pas na de JavaScript. Komt terug op 0,9 met responsive
// afbeeldingen uit de API/CMS en prerendering (NFR-P-01).
const homeMobilePerformance = 0.8;
const quality = {
'categories:performance': ['error', { minScore: 0.9 }],
'categories:accessibility': ['error', { minScore: 1 }],
'categories:best-practices': ['error', { minScore: 1 }],
};
// SEO-audits die ook voor noindex-pagina's moeten slagen. Alleen
// `is-crawlable` mag falen: die pagina's staan bewust op noindex.
const seoBasics = {
'document-title': 'error',
'link-text': 'error',
'crawlable-anchors': 'error',
'image-alt': 'error',
};
const escape = (path) => path.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
const exact = (paths) => `^${origin}(${paths.map(escape).join('|')})$`;
module.exports = {
indexedPaths,
noindexPaths,
notFoundPath,
ci: {
collect: {
startServerCommand: 'pnpm preview --port 4173 --strictPort',
startServerReadyPattern: 'Local',
url: [...indexedPaths, ...noindexPaths, notFoundPath].map(
(path) => origin + path,
),
numberOfRuns: 1,
},
assert: {
assertMatrix: [
{
matchingUrlPattern: exact(indexedPaths),
assertions: {
...quality,
'categories:performance': [
'error',
{ minScore: homeMobilePerformance },
],
'categories:seo': ['error', { minScore: 1 }],
},
},
{
matchingUrlPattern: exact(noindexPaths),
assertions: {
...quality,
...seoBasics,
'meta-description': 'error',
canonical: 'error',
},
},
{
matchingUrlPattern: exact([notFoundPath]),
assertions: { ...quality, ...seoBasics },
},
],
},
upload: {
// Resultaten blijven lokaal in .lighthouseci/
target: 'filesystem',
outputDir: '.lighthouseci',
},
},
};