diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-31 03:09:17 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-31 03:09:17 +0800 |
commit | b4f916d214dd80c11b4cb5db8af9545d5161f97d (patch) | |
tree | 65496c1a1acc3945abf3847d198af46e713b68fc | |
parent | 79faf7d3cb12a68ef336002b59b339f675d4c32a (diff) | |
download | dexon-0x-contracts-b4f916d214dd80c11b4cb5db8af9545d5161f97d.tar.gz dexon-0x-contracts-b4f916d214dd80c11b4cb5db8af9545d5161f97d.tar.zst dexon-0x-contracts-b4f916d214dd80c11b4cb5db8af9545d5161f97d.zip |
Standardize child naming
-rw-r--r-- | packages/monorepo-scripts/src/utils/publish_utils.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 7209fa344..9b5ff378e 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -190,10 +190,21 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: cwd, }); - // For each entry, see if it was exported in index.ts. If not, remove it. + // Unfortunately TypeDoc children names will only be prefixed with the name of the package _if_ we passed + // TypeDoc files outside of the packages root path (i.e this package exports another package found in our + // monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add + // it here when necessary. const typedocOutputString = readFileSync(jsonFilePath).toString(); const typedocOutput = JSON.parse(typedocOutputString); const finalTypeDocOutput = _.clone(typedocOutput); + _.each(typedocOutput.children, (child, i) => { + if (!_.includes(child.name, '/src/')) { + const nameWithoutQuotes = child.name.replace(/"/g, ''); + finalTypeDocOutput.children[i].name = `"${packageName}/src/${nameWithoutQuotes}"`; + } + }); + + // For each entry, see if it was exported in index.ts. If not, remove it. _.each(typedocOutput.children, (file, i) => { const exportItems = findExportItemsGivenTypedocName(exportPathToExportedItems, packageName, file.name); _.each(file.children, (child, j) => { |