diff options
author | Fabio Berger <me@fabioberger.com> | 2018-08-17 05:57:45 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-08-17 05:57:45 +0800 |
commit | 8e3df2b5aeac9d6776640be1248863055c75cf4a (patch) | |
tree | 97fd70a5f9b821334f0590b63557b6bac39924a5 /packages/react-docs/src/utils | |
parent | bf9ee82d9f4a2fec392f0ee58342fc6b3be94dff (diff) | |
download | dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.gz dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.bz2 dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.lz dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.xz dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.zst dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.zip |
Render external dep exports
Diffstat (limited to 'packages/react-docs/src/utils')
-rw-r--r-- | packages/react-docs/src/utils/constants.ts | 1 | ||||
-rw-r--r-- | packages/react-docs/src/utils/typedoc_utils.ts | 21 |
2 files changed, 20 insertions, 2 deletions
diff --git a/packages/react-docs/src/utils/constants.ts b/packages/react-docs/src/utils/constants.ts index c3c74fd11..97bedf2db 100644 --- a/packages/react-docs/src/utils/constants.ts +++ b/packages/react-docs/src/utils/constants.ts @@ -2,6 +2,7 @@ import { SupportedDocJson } from '../types'; export const constants = { TYPES_SECTION_NAME: 'types', + EXTERNAL_EXPORTS_SECTION_NAME: 'externalExports', TYPE_TO_SYNTAX: { [SupportedDocJson.Doxity]: 'solidity', [SupportedDocJson.TypeDoc]: 'typescript', diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index e10493673..989485dfc 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -7,13 +7,13 @@ import { CustomTypeChild, DocAgnosticFormat, DocSection, + ExternalExportToLink, ExternalTypeToLink, GeneratedDocJson, IndexSignature, KindString, Parameter, Property, - SectionsMap, Type, TypeDocNode, TypeDocType, @@ -28,6 +28,7 @@ import { constants } from './constants'; export class TypeDocUtils { private _typeDocNameOrder: string[]; private _externalTypeToLink: ExternalTypeToLink; + private _externalExportToLink: ExternalExportToLink; private _docsInfo: DocsInfo; private _typeDocJson: TypeDocNode; private _classNames: string[]; @@ -36,6 +37,7 @@ export class TypeDocUtils { const exportPathOrder = generatedDocJson.metadata.exportPathOrder; const exportPathToTypedocNames = generatedDocJson.metadata.exportPathToTypedocNames; this._externalTypeToLink = generatedDocJson.metadata.externalTypeToLink; + this._externalExportToLink = generatedDocJson.metadata.externalExportToLink; this._typeDocJson = generatedDocJson.typedocJson; // TODO: Extract the non typeDoc exports, and render them somehow @@ -88,6 +90,22 @@ export class TypeDocUtils { } public convertToDocAgnosticFormat(): DocAgnosticFormat { const docAgnosticFormat: DocAgnosticFormat = {}; + + if (!_.isEmpty(this._externalExportToLink)) { + this._docsInfo.sections[constants.EXTERNAL_EXPORTS_SECTION_NAME] = constants.EXTERNAL_EXPORTS_SECTION_NAME; + this._docsInfo.menu[constants.EXTERNAL_EXPORTS_SECTION_NAME] = [constants.EXTERNAL_EXPORTS_SECTION_NAME]; + const docSection: DocSection = { + comment: 'This package also re-exports some third-party libraries for your convenience.', + constructors: [], + methods: [], + functions: [], + properties: [], + types: [], + externalExportToLink: this._externalExportToLink, + }; + docAgnosticFormat[constants.EXTERNAL_EXPORTS_SECTION_NAME] = docSection; + } + const typeEntities: TypeDocNode[] = []; _.each(this._typeDocNameOrder, typeDocName => { const fileChildIndex = _.findIndex(this._typeDocJson.children, child => child.name === typeDocName); @@ -458,7 +476,6 @@ export class TypeDocUtils { method: methodIfExists, indexSignature: indexSignatureIfExists, }; - console.log('this._externalTypeToLink', this._externalTypeToLink); const externalLinkIfExists = this._externalTypeToLink[entity.name]; if (!_.isUndefined(externalLinkIfExists)) { type.externalLink = externalLinkIfExists; |