chore(bibliotheque): 13 bis, le registre se lit par AEP_REGISTRE (le vault reste le défaut des tests)

exporter-registre.mjs : sans --registre, AEP_REGISTRE. registre_lib.py : AEP_REGISTRE, puis REGISTRE.
test-bibliotheque.mjs : AEP_REGISTRE, puis BIBLIOTHEQUE_REGISTRE, puis le registre du vault.
Sert à éprouver un registre candidat sans toucher au vault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jules
2026-11-20 17:43:45 +01:00
co-authored by Claude Opus 5.5
parent 1a1c976c12
commit 589c04bf5f
3 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
* Usage :
* node scripts/bibliotheque/exporter-registre.mjs --registre <registre.json> --jeux <dossier des jeux M6b> \
* [--sortie data/bibliotheque/oeuvres-registre.json]
* Sans --registre : la variable AEP_REGISTRE (lot 13 bis, pour éprouver un registre candidat).
*
* Lit le registre du vault (lecture seule) et le dossier des jeux M6b (un `<slug>/<slug>__extraction.json`
* par œuvre lue, pour joindre l'identifiant du registre au slug de la fiche) ; écrit un seul fichier,
@@ -86,7 +87,7 @@ const principal = process.argv[1] && import.meta.url.endsWith(process.argv[1].sp
if (principal) {
const a = process.argv.slice(2)
const arg = (k, d) => (a.includes(k) ? a[a.indexOf(k) + 1] : d)
const registre = arg('--registre')
const registre = arg('--registre', process.env.AEP_REGISTRE) // lot 13 bis : AEP_REGISTRE, si --registre manque
const jeux = arg('--jeux')
const sortie = arg('--sortie', 'data/bibliotheque/oeuvres-registre.json')
if (!registre || !jeux) {
+3 -1
View File
@@ -15,7 +15,9 @@ appartient_a seulement). « À lire ensuite » s'appuie donc sur : le même aute
"""
import json, pathlib, os
REGISTRE = pathlib.Path(os.environ["REGISTRE"]) if os.environ.get("REGISTRE") else None
# lot 13 bis : AEP_REGISTRE (un registre candidat), puis REGISTRE ; --registre des scripts l'emporte (configurer)
_ENV_REG = os.environ.get("AEP_REGISTRE") or os.environ.get("REGISTRE")
REGISTRE = pathlib.Path(_ENV_REG) if _ENV_REG else None
RECOUPEMENT = pathlib.Path(__file__).resolve().parents[2] / "data" / "bibliotheque" / "regime-recoupe.json"
_REC = None
DP, SD = "domaine public", "sous droits"