Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md (setup and step-by-step recipes) and a README in each main folder, with an index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to JSDoc @file blocks, define a three-level header template in website/AGENTS.md and check the header in tests/file-headers.test.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
/**
|
|
* @file Vérifie que chaque fichier JavaScript du dépôt commence par son en-tête JSDoc `/** @file … *\/`.
|
|
*
|
|
* Attention : seule la présence de l'en-tête est contrôlée ; son contenu suit le gabarit de website/AGENTS.md.
|
|
* @see website/AGENTS.md
|
|
*/
|
|
|
|
import assert from "node:assert/strict";
|
|
import { readdir, readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { test } from "node:test";
|
|
|
|
const ROOTS = ["website/src", "services", "scripts", "tests", "e2e"];
|
|
const ROOT_FILES = ["server.mjs", "vite.config.js", "eslint.config.js", "playwright.config.js", "playwright.cards.config.js", "playwright.production.config.js"];
|
|
const SOURCE = /\.(js|jsx|mjs)$/;
|
|
|
|
async function sourceFiles() {
|
|
const files = [...ROOT_FILES];
|
|
for (const root of ROOTS) {
|
|
const entries = await readdir(root, { recursive: true });
|
|
files.push(...entries.filter((entry) => SOURCE.test(entry) && !entry.includes("node_modules")).map((entry) => join(root, entry)));
|
|
}
|
|
return files;
|
|
}
|
|
|
|
test("every JavaScript file starts with a JSDoc @file header", async () => {
|
|
const missing = [];
|
|
for (const file of await sourceFiles()) {
|
|
const source = await readFile(file, "utf8");
|
|
if (!/^\/\*\*\n \* @file \S/.test(source)) missing.push(file);
|
|
}
|
|
assert.deepEqual(missing, [], "Start these files with /** @file … */ (template: website/AGENTS.md)");
|
|
});
|