diff options
author | Fabio Berger <me@fabioberger.com> | 2018-08-15 08:41:03 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-08-15 08:41:03 +0800 |
commit | 83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd (patch) | |
tree | d4f869ee80e81ee6fdcff83dcc53517acd07744f /packages | |
parent | cb5d8d75bf03910d1e763eb34907ada296ed3062 (diff) | |
download | dexon-0x-contracts-83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd.tar dexon-0x-contracts-83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd.tar.gz dexon-0x-contracts-83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd.tar.bz2 dexon-0x-contracts-83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd.tar.lz dexon-0x-contracts-83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd.tar.xz dexon-0x-contracts-83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd.tar.zst dexon-0x-contracts-83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd.zip |
Move purging private underscored items to the doc json generation phase
Diffstat (limited to 'packages')
-rw-r--r-- | packages/0x.js/src/index.ts | 2 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 31 | ||||
-rw-r--r-- | packages/react-docs/src/components/signature_block.tsx | 3 | ||||
-rw-r--r-- | packages/react-docs/src/utils/typedoc_utils.ts | 21 |
4 files changed, 27 insertions, 30 deletions
diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index a26d827d7..d8ad6a969 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -61,8 +61,6 @@ export { ErrorCallback, } from '@0xproject/subproviders'; -export { Web3Wrapper, NodeType } from '@0xproject/web3-wrapper'; - export { AbiDecoder } from '@0xproject/utils'; export { BigNumber } from '@0xproject/utils'; diff --git a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts index 187358421..2bc5441fc 100644 --- a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts +++ b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts @@ -143,7 +143,10 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: } }); - // For each entry, see if it was exported in index.ts. If not, remove it. + // For each entry, remove it if: + // - it was not exported in index.ts + // - the constructor is to be ignored + // - it begins with an underscore const exportPathToTypedocNames: ExportNameToTypedocNames = {}; _.each(typedocOutput.children, (file, i) => { const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name); @@ -155,18 +158,22 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: _.each(file.children, (child, j) => { if (!_.includes(exportItems, child.name)) { delete finalTypeDocOutput.children[i].children[j]; + return; } - 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, - ); - } - }); - } + const innerChildren = typedocOutput.children[i].children[j].children; + _.each(innerChildren, (innerChild, k) => { + const isHiddenConstructor = + child.kindString === 'Class' && + _.includes(CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name) && + innerChild.kindString === 'Constructor'; + const isPrivate = _.startsWith(innerChild.name, '_'); + if (isHiddenConstructor || isPrivate) { + 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); }); diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 934232efe..2818d9c5f 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -44,9 +44,6 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu } public render(): React.ReactNode { const method = this.props.method; - if (typeDocUtils.isPrivateOrProtectedProperty(method.name)) { - return null; - } return ( <div diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index ab5408ec2..9843ec9fa 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -43,9 +43,6 @@ export const typeDocUtils = { isProperty(entity: TypeDocNode): boolean { return entity.kindString === KindString.Property; }, - isPrivateOrProtectedProperty(propertyName: string): boolean { - return _.startsWith(propertyName, '_'); - }, getModuleDefinitionsBySectionName(versionDocObj: TypeDocNode, configModulePaths: string[]): TypeDocNode[] { const moduleDefinitions: TypeDocNode[] = []; const jsonModules = versionDocObj.children; @@ -217,16 +214,14 @@ export const typeDocUtils = { break; case KindString.Property: - if (!typeDocUtils.isPrivateOrProtectedProperty(entity.name)) { - const property = typeDocUtils._convertProperty( - entity, - docsInfo.sections, - sectionName, - docsInfo.id, - classNames, - ); - docSection.properties.push(property); - } + const property = typeDocUtils._convertProperty( + entity, + docsInfo.sections, + sectionName, + docsInfo.id, + classNames, + ); + docSection.properties.push(property); break; case KindString.Variable: |