fix(scripts): ignore declarations without a description (#122)

This commit is contained in:
sigoden
2024-11-04 07:27:47 +08:00
committed by GitHub
parent 2cac7d90c8
commit afbd03f963
3 changed files with 10 additions and 6 deletions
+5 -3
View File
@@ -10,11 +10,13 @@ function main() {
const isTool = path.dirname(scriptfile) == "tools";
const contents = fs.readFileSync(process.argv[2], "utf8");
const functions = extractFunctions(contents, isTool);
let declarations = functions.map(({ funcName, jsdoc }) => {
let declarations = [];
for (const { funcName, jsdoc } of functions) {
const { description, params } = parseJsDoc(jsdoc, funcName);
if (!description) continue;
const declaration = buildDeclaration(funcName, description, params);
return declaration;
});
declarations.push(declaration);
}
if (isTool) {
const name = getBasename(scriptfile);
if (declarations.length > 0) {