Fix de playwright
This commit is contained in:
@@ -212,6 +212,10 @@ Il s'agit d'un site statique généré avec Hugo, dont la version peut être vé
|
||||
- Vérifie la disponibilité des sites liés partout dans `content/` (code HTTP 200 ou autre)
|
||||
- On cherche les liens dans les fichiers markdown (incluant le frontmatter) et les fichiers `*.yaml`
|
||||
- On ignore les URL placés dans des blocs de code mono ou multilignes
|
||||
- La vérification enrichie repose sur Playwright et le Chromium embarqué par la librairie `playwright`
|
||||
- La variable `externalLinks.usePlaywright` de `tools/config/config.json` doit être positionnée à `true` pour activer cette vérification
|
||||
- L'attribut `externalLinks.playwrightExecutablePath` doit rester vide ou à `null` afin de laisser Playwright utiliser son propre navigateur, compatible avec la configuration `nix-ld` déclarée dans `/etc/nixos/nix-ld-libraries.nix`
|
||||
- Si `externalLinks.playwrightExecutablePath` est renseigné, il doit impérativement pointer vers un binaire existant : dans le cas contraire, le script se termine en erreur et interrompt le déploiement
|
||||
|
||||
#### Internes (`tools/check_internal_links.js`)
|
||||
|
||||
|
||||
@@ -76,24 +76,28 @@ const MAX_REDIRECTS = Math.max(
|
||||
);
|
||||
const DEFAULT_USER_AGENT = buildUserAgent(settings.userAgent);
|
||||
const IGNORE_HOSTS = parseIgnoreHosts(settings.ignoreHosts);
|
||||
const PLAYWRIGHT_RESOLUTION =
|
||||
settings.usePlaywright === true
|
||||
? resolvePlaywrightExecutable(settings.playwrightExecutablePath)
|
||||
: { path: null, missing: null };
|
||||
const PLAYWRIGHT_EXECUTABLE = PLAYWRIGHT_RESOLUTION.path;
|
||||
const PLAYWRIGHT_ENABLED = settings.usePlaywright === true && !PLAYWRIGHT_RESOLUTION.missing;
|
||||
if (settings.usePlaywright === true && PLAYWRIGHT_RESOLUTION.missing) {
|
||||
console.warn(
|
||||
[
|
||||
"Playwright désactivé : impossible de trouver l'exécutable demandé",
|
||||
`"${PLAYWRIGHT_RESOLUTION.missing}".`,
|
||||
`Corrigez externalLinks.playwrightExecutablePath dans ${path.relative(
|
||||
SITE_ROOT,
|
||||
CONFIG_PATH
|
||||
)} pour rétablir la vérification enrichie.`,
|
||||
].join(" ")
|
||||
);
|
||||
let PLAYWRIGHT_EXECUTABLE = null;
|
||||
if (settings.usePlaywright === true && typeof settings.playwrightExecutablePath === "string") {
|
||||
const trimmedExecutable = settings.playwrightExecutablePath.trim();
|
||||
if (trimmedExecutable) {
|
||||
const resolution = resolvePlaywrightExecutable(trimmedExecutable);
|
||||
if (resolution.missing) {
|
||||
console.error(
|
||||
[
|
||||
"Playwright activé mais impossible de trouver l'exécutable demandé",
|
||||
`"${resolution.missing}".`,
|
||||
`Corrigez externalLinks.playwrightExecutablePath dans ${path.relative(
|
||||
SITE_ROOT,
|
||||
CONFIG_PATH
|
||||
)} ou laissez ce champ vide pour utiliser la configuration Playwright par défaut.`,
|
||||
].join(" ")
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
PLAYWRIGHT_EXECUTABLE = resolution.path;
|
||||
}
|
||||
}
|
||||
const PLAYWRIGHT_ENABLED = settings.usePlaywright === true;
|
||||
const PLAYWRIGHT_TIMEOUT_MS = Math.max(
|
||||
1000,
|
||||
(Number.isFinite(Number(settings.playwrightTimeoutSeconds))
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"cookieJar": "tools/cache/curl_cookies.txt",
|
||||
"usePlaywright": true,
|
||||
"playwrightTimeoutSeconds": 10,
|
||||
"playwrightExecutablePath": "/nix/store/jaf9gnbln0cbs2vspfdblc4ff6vv1kk5-chromium-142.0.7444.175/bin/chromium",
|
||||
"playwrightExecutablePath": null,
|
||||
"ignoreHosts": [
|
||||
"10.0.2.1",
|
||||
"web.archive.org",
|
||||
@@ -133,4 +133,4 @@
|
||||
"post": 24
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user