fix(annotations): fail-open when src/annotations is missing
This commit is contained in:
@@ -112,7 +112,7 @@ export const GET: APIRoute = async () => {
|
||||
missingRoot = true;
|
||||
console.warn(`[annotations-index] Missing annotations root: ${ANNO_ROOT} (${e?.message || e})`);
|
||||
files = [];
|
||||
errors.push({ file: "src/annotations", error: `Missing annotations root: ${e?.message || e}` });
|
||||
// ✅ surtout PAS d'errors.push ici
|
||||
}
|
||||
|
||||
for (const fp of files) {
|
||||
@@ -183,6 +183,14 @@ export const GET: APIRoute = async () => {
|
||||
pg.paras = next;
|
||||
}
|
||||
|
||||
const warnings: Array<{ where: string; warning: string }> = [];
|
||||
if (missingRoot) {
|
||||
warnings.push({
|
||||
where: "src/pages/annotations-index.json.ts",
|
||||
warning: `Missing annotations root "${ANNO_ROOT}" (treated as empty).`,
|
||||
});
|
||||
}
|
||||
|
||||
const out = {
|
||||
schema: 1,
|
||||
generatedAt: new Date().toISOString(),
|
||||
@@ -192,6 +200,7 @@ export const GET: APIRoute = async () => {
|
||||
paras: Object.values(pages).reduce((n, p) => n + Object.keys(p.paras || {}).length, 0),
|
||||
errors: errors.length,
|
||||
},
|
||||
warnings,
|
||||
errors,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user