From b4f916d214dd80c11b4cb5db8af9545d5161f97d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 30 Jul 2018 21:09:17 +0200 Subject: Standardize child naming --- packages/monorepo-scripts/src/utils/publish_utils.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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) => { -- cgit