Add ability to hide specific class constructors

This commit is contained in:
Fabio Berger 2018-08-14 16:34:48 -07:00
parent 04e00e0c28
commit 19e17ba128

View File

@ -28,6 +28,16 @@ const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = {
'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description',
}; };
const CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[] = [
'ERC20ProxyWrapper',
'ERC20TokenWrapper',
'ERC721ProxyWrapper',
'ERC721TokenWrapper',
'EtherTokenWrapper',
'ExchangeWrapper',
'ForwarderWrapper',
];
export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise<void> { export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise<void> {
const monorepoPackages = utils.getPackages(constants.monorepoRootPath); const monorepoPackages = utils.getPackages(constants.monorepoRootPath);
const pkg = _.find(monorepoPackages, monorepoPackage => { const pkg = _.find(monorepoPackages, monorepoPackage => {
@ -146,6 +156,17 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging:
if (!_.includes(exportItems, child.name)) { if (!_.includes(exportItems, child.name)) {
delete finalTypeDocOutput.children[i].children[j]; delete finalTypeDocOutput.children[i].children[j];
} }
if (child.kindString === 'Class' && _.includes(CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name)) {
const classChildren = typedocOutput.children[i].children[j].children;
_.each(classChildren, (classChild, k) => {
if (classChild.kindString === 'Constructor') {
delete finalTypeDocOutput.children[i].children[j].children[k];
finalTypeDocOutput.children[i].children[j].children = _.compact(
finalTypeDocOutput.children[i].children[j].children,
);
}
});
}
}); });
finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children);
}); });