()
| 18 | * and the tree is rebuilt on every call so edits show up. |
| 19 | */ |
| 20 | export const getPageTree = (): PageTree => { |
| 21 | if (cached) return cached |
| 22 | const tree = buildPageTree(contentDir) |
| 23 | const errors = [...tree.errors, ...checkRedirects(tree)] |
| 24 | if (process.env.NODE_ENV !== "production") { |
| 25 | report([...errors, ...tree.warnings]) |
| 26 | return tree |
| 27 | } |
| 28 | if (errors.length) |
| 29 | throw new Error(`The docs have problems:\n- ${errors.join("\n- ")}`) |
| 30 | report(tree.warnings) |
| 31 | return (cached = tree) |
| 32 | } |
no test coverage detected