()
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Registered projects, or `[]`. |
| 18 | * |
| 19 | * This must never return a non-array. It used to hand back `parsed.projects` unchecked, so a |
| 20 | * `projects.json` that was hand-edited into a bare array — or anything else without that key |
| 21 | * — yielded `undefined`, and every caller does `.map`/`.find` on the result. One malformed |
| 22 | * file 500'd routes across the whole engine, blaming the server for the operator's typo. |
| 23 | */ |
| 24 | export async function loadProjects(): Promise<Project[]> { |
| 25 | let raw: string; |
| 26 | try { |
| 27 | raw = await fs.readFile(projectsFile(), 'utf8'); |
no test coverage detected