diff options
author | Fabio Berger <me@fabioberger.com> | 2018-08-22 18:30:24 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-08-22 18:30:24 +0800 |
commit | c12f0d04bb2f0d5ad73943d02a592a110423a423 (patch) | |
tree | 4dd1625693c103f256752ab982e19198b17bb1b2 | |
parent | 22de88035c35731f0a93fc0acb87c185c1e2730c (diff) | |
download | dexon-sol-tools-c12f0d04bb2f0d5ad73943d02a592a110423a423.tar.gz dexon-sol-tools-c12f0d04bb2f0d5ad73943d02a592a110423a423.tar.zst dexon-sol-tools-c12f0d04bb2f0d5ad73943d02a592a110423a423.zip |
Fix bugs in doc gen due to clone vs cloneDeep and pre-maturely removing placeholder undefined's in array iteration
-rw-r--r-- | packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 14 |
1 files changed, 7 insertions, 7 deletions
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 9e5f437fa..bbc763a6b 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 @@ -213,8 +213,8 @@ export class DocGenerateAndUploadUtils { utils.log('GENERATE_UPLOAD_DOCS: Modifying Typedoc JSON to our custom format...'); const typedocOutputString = readFileSync(jsonFilePath).toString(); const typedocOutput = JSON.parse(typedocOutputString); - let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); - modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput); + const standardizedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); + const modifiedTypedocOutput = this._pruneTypedocOutput(standardizedTypedocOutput); if (!_.includes(docGenConfigs.TYPES_ONLY_LIBRARIES, this._packageName)) { const propertyName = ''; // Root has no property name @@ -345,7 +345,7 @@ export class DocGenerateAndUploadUtils { * - it begins with an underscore (i.e is private) */ private _pruneTypedocOutput(typedocOutput: any): any { - const modifiedTypedocOutput = _.clone(typedocOutput); + const modifiedTypedocOutput = _.cloneDeep(typedocOutput); _.each(typedocOutput.children, (file, i) => { const exportPath = this._findExportPathGivenTypedocName(file.name); const exportItems = this._exportPathToExportedItems[exportPath]; @@ -365,11 +365,11 @@ export class DocGenerateAndUploadUtils { const isPrivate = _.startsWith(innerChild.name, '_'); if (isHiddenConstructor || isPrivate) { delete modifiedTypedocOutput.children[i].children[j].children[k]; - modifiedTypedocOutput.children[i].children[j].children = _.compact( - modifiedTypedocOutput.children[i].children[j].children, - ); } }); + modifiedTypedocOutput.children[i].children[j].children = _.compact( + modifiedTypedocOutput.children[i].children[j].children, + ); }); modifiedTypedocOutput.children[i].children = _.compact(modifiedTypedocOutput.children[i].children); }); @@ -382,7 +382,7 @@ export class DocGenerateAndUploadUtils { * them here when necessary. */ private _standardizeTypedocOutputTopLevelChildNames(typedocOutput: any): any { - const modifiedTypedocOutput = _.clone(typedocOutput); + const modifiedTypedocOutput = _.cloneDeep(typedocOutput); _.each(typedocOutput.children, (child, i) => { if (!_.includes(child.name, '/src/')) { const nameWithoutQuotes = child.name.replace(/"/g, ''); |