From 63adaee7f28666b2f48510f4fcfb3db2d3ec7d78 Mon Sep 17 00:00:00 2001 From: Tony Date: Sun, 24 Mar 2024 05:06:06 +0800 Subject: [PATCH] chore: add typo check in build routes --- scripts/workflow/build-routes.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/workflow/build-routes.ts b/scripts/workflow/build-routes.ts index 02928a556..af441dfd5 100644 --- a/scripts/workflow/build-routes.ts +++ b/scripts/workflow/build-routes.ts @@ -94,7 +94,11 @@ function generateMd(lang) { const md = {}; for (const category in docs) { const nameObj = categories.find((c) => c.link.includes(category)); - md[category] = `# ${`${nameObj!.icon} ${nameObj![lang]}`}\n\n`; + if (!nameObj) { + throw new Error(`Category not found: ${category}, please double check your spelling.`); + } + + md[category] = `# ${`${nameObj.icon} ${nameObj[lang]}`}\n\n`; const namespaces = Object.keys(docs[category]).sort((a, b) => { const aname = docs[category][a].name[0];