Move external types to link mapping to doc generation util and refactor typedocUtils to be a class to avoid excessive param passing

This commit is contained in:
Fabio Berger
2018-08-15 11:36:45 -07:00
parent 3b8a343711
commit a8d44ccc48
17 changed files with 138 additions and 322 deletions

View File

@@ -6,17 +6,16 @@ import {
ContractsByVersionByNetworkId,
DocAgnosticFormat,
DocsInfoConfig,
DocsInfoTypeConfigs,
DocsMenu,
DoxityDocObj,
GeneratedDocJson,
SectionNameToMarkdownByVersion,
SectionsMap,
SupportedDocJson,
TypeDefinitionByName,
GeneratedDocJson,
} from './types';
import { doxityUtils } from './utils/doxity_utils';
import { typeDocUtils } from './utils/typedoc_utils';
import { TypeDocUtils } from './utils/typedoc_utils';
export class DocsInfo {
public id: string;
@@ -27,7 +26,6 @@ export class DocsInfo {
public sections: SectionsMap;
public sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion;
public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
public typeConfigs: DocsInfoTypeConfigs;
constructor(config: DocsInfoConfig) {
this.id = config.id;
this.type = config.type;
@@ -37,7 +35,6 @@ export class DocsInfo {
this.sections = config.markdownSections;
this.sectionNameToMarkdownByVersion = config.sectionNameToMarkdownByVersion;
this.contractsByVersionByNetworkId = config.contractsByVersionByNetworkId;
this.typeConfigs = config.typeConfigs;
}
public getMenuSubsectionsBySection(docAgnosticFormat?: DocAgnosticFormat): MenuSubsectionsBySection {
const menuSubsectionsBySection = {} as MenuSubsectionsBySection;
@@ -101,7 +98,8 @@ export class DocsInfo {
if (this.type === SupportedDocJson.Doxity) {
return doxityUtils.convertToDocAgnosticFormat(docObj as DoxityDocObj);
} else {
return typeDocUtils.convertToDocAgnosticFormat(docObj as GeneratedDocJson, this);
const typeDocUtils = new TypeDocUtils(docObj as GeneratedDocJson, this);
return typeDocUtils.convertToDocAgnosticFormat();
}
}
}