diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-30 21:40:10 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-30 21:40:10 +0800 |
commit | 79b1b6c8e08f9cc61babd75fdaff14472216d0f2 (patch) | |
tree | e142fa0fab5ded843ad2e6894a239325573e93b3 /packages/monorepo-scripts/src/utils | |
parent | b56fc697c41649fdb3bdeaf9709781c9fd166b08 (diff) | |
download | dexon-sol-tools-79b1b6c8e08f9cc61babd75fdaff14472216d0f2.tar dexon-sol-tools-79b1b6c8e08f9cc61babd75fdaff14472216d0f2.tar.gz dexon-sol-tools-79b1b6c8e08f9cc61babd75fdaff14472216d0f2.tar.bz2 dexon-sol-tools-79b1b6c8e08f9cc61babd75fdaff14472216d0f2.tar.lz dexon-sol-tools-79b1b6c8e08f9cc61babd75fdaff14472216d0f2.tar.xz dexon-sol-tools-79b1b6c8e08f9cc61babd75fdaff14472216d0f2.tar.zst dexon-sol-tools-79b1b6c8e08f9cc61babd75fdaff14472216d0f2.zip |
Fix bugs in doc gen
Diffstat (limited to 'packages/monorepo-scripts/src/utils')
-rw-r--r-- | packages/monorepo-scripts/src/utils/publish_utils.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index a0a414cda..7209fa344 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -137,29 +137,33 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // and see which specific files we must pass to TypeDoc. let typeDocExtraFileIncludes: string[] = []; _.each(exportPathToExportedItems, (exportedItems, exportPath) => { - const pathIfExists = pkgNameToPath[exportPath]; - if (_.isUndefined(pathIfExists)) { - return; // It's an external package - } - const isInternalToPkg = _.startsWith(exportPath, '.'); if (isInternalToPkg) { const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); typeDocExtraFileIncludes.push(pathToInternalPkg); return; // Right? } + + const pathIfExists = pkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + return; // It's an external package + } + const typeDocSourceIncludes = new Set(); const pathToIndex = `${pathIfExists}/src/index.ts`; const innerExportPathToExportedItems = getExportPathToExportedItems(pathToIndex); _.each(exportedItems, exportName => { _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { - if (!_.startsWith(innerExportPath, './') && _.includes(innerExportItems, exportName)) { + if (!_.includes(innerExportItems, exportName)) { + return; + } + if (!_.startsWith(innerExportPath, './')) { throw new Error( `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is itself exported from an external package. To fix this, export the external dependency directly, not indirectly through ${innerExportPath}.`, ); - } else if (_.includes(innerExportItems, exportName)) { + } else { const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); typeDocSourceIncludes.add(absoluteSrcPath); } |