Skip to content

Commit

Permalink
Merge pull request #14771 from lukasmatta/fix/14770-api-generator
Browse files Browse the repository at this point in the history
Fixed #14770 - api-generator problem
  • Loading branch information
cetincakiroglu authored Mar 28, 2024
2 parents eed5029 + 52c76ba commit 3d7db6f
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 40 deletions.
26 changes: 14 additions & 12 deletions api-generator/build-apidoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ async function main() {
return text.replace(/{/g, '{').replace(/}/g, '}');
};

const getDeprecatedText = (signature) => {
const deprecatedTag = signature?.comment?.getTag('@deprecated');
return deprecatedTag ? parseText(deprecatedTag.content[0].text) : undefined;
};

const modules = project.groups.find((g) => g.title === 'Modules');

if (isProcessable(modules)) {
Expand Down Expand Up @@ -89,13 +94,10 @@ async function main() {
readonly: prop.flags.isReadonly,
type: prop.getSignature && prop.getSignature.type ? prop.getSignature.type.toString() : prop.type ? prop.type.toString() : null,
default: prop.type && prop.type.name === 'boolean' && !prop.defaultValue ? 'false' : prop.defaultValue ? prop.defaultValue.replace(/^'|'$/g, '') : undefined,
description: prop.getSignature && prop.getSignature.comment ? prop.getSignature.comment.summary.map((s) => s.text || '').join(' ') : prop.comment && prop.comment.summary.map((s) => s.text || '').join(' '),
deprecated:
prop.getSignature && prop.getSignature.comment && prop.getSignature.comment.getTag('@deprecated')
? parseText(prop.getSignature.comment.getTag('@deprecated').content[0].text)
: prop.comment && prop.comment.getTag('@deprecated')
? parseText(prop.comment.getTag('@deprecated').content[0].text)
: undefined
description: ((prop.getSignature?.comment?.summary || prop.setSignature?.comment?.summary) || prop.comment?.summary)?.map((s) => s.text || '').join(' '),
deprecated: getDeprecatedText(prop.getSignature)
|| getDeprecatedText(prop.setSignature)
|| getDeprecatedText(prop)
});
});
doc[name]['components'][componentName]['props'] = props;
Expand All @@ -113,7 +115,7 @@ async function main() {
name: emitter.name,
parameters: [{ name: extractParameter(emitter) && extractParameter(emitter).includes('Event') ? 'event' : 'value', type: extractParameter(emitter) }],
description: emitter.comment && emitter.comment.summary.map((s) => s.text || '').join(' '),
deprecated: emitter.comment && emitter.comment.getTag('@deprecated') ? parseText(emitter.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(emitter)
});
});

Expand Down Expand Up @@ -164,7 +166,7 @@ async function main() {
readonly: child.flags.isReadonly,
type: child.type && child.type.toString(),
description: child.comment && child.comment.summary.map((s) => s.text || '').join(' '),
deprecated: child.comment && child.comment.getTag('@deprecated') ? parseText(child.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(child)
}))
});
});
Expand Down Expand Up @@ -192,7 +194,7 @@ async function main() {
readonly: child.flags.isReadonly,
type: child.type && child.type.toString(),
description: child.comment && child.comment.summary.map((s) => s.text || '').join(' '),
deprecated: child.comment && child.comment.getTag('@deprecated') ? parseText(child.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(child)
}))
});
});
Expand Down Expand Up @@ -243,7 +245,7 @@ async function main() {
};
}),
description: signature.comment && signature.comment.summary.map((s) => s.text || '').join(' '),
deprecated: signature.comment && signature.comment.getTag('@deprecated') ? parseText(signature.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(signature)
});
});
});
Expand All @@ -269,7 +271,7 @@ async function main() {
readonly: child.flags.isReadonly,
type: child.type ? child.type.toString() : extractParameter(int),
description: child.comment && child.comment.summary.map((s) => s.text || '').join(' '),
deprecated: child.comment && child.comment.getTag('@deprecated') ? parseText(child.comment.getTag('@deprecated').content[0].text) : undefined
deprecated: getDeprecatedText(child)
}))
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@
"@docsearch/js": "^3.3.4",
"esbuild": "^0.19.8"
}
}
}
2 changes: 1 addition & 1 deletion src/app/components/api/messageservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class MessageService {
}
}
/**
* Insterts new messages.
* Inserts new messages.
* @param {Message[]} messages - Messages to be added.
* @group Method
*/
Expand Down
Loading

0 comments on commit 3d7db6f

Please sign in to comment.