aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/monorepo-scripts/src/utils/publish_utils.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts
index 3cdd2c4fb..974fb4d0d 100644
--- a/packages/monorepo-scripts/src/utils/publish_utils.ts
+++ b/packages/monorepo-scripts/src/utils/publish_utils.ts
@@ -274,7 +274,7 @@ function findExportPathGivenTypedocName(
packageName: string,
typedocName: string,
): string {
- const typeDocNameWithoutQuotes = _.replace(typedocName, '"', '');
+ const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, '');
const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {};
const exportPaths = _.keys(exportPathToExportedItems);
const sanitizedExportPaths = _.map(exportPaths, exportPath => {
@@ -292,7 +292,13 @@ function findExportPathGivenTypedocName(
sanitizedExportPathToExportPath[exportPath] = exportPath;
return exportPath;
});
- const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPaths, p => {
+ // We need to sort the exportPaths by length (longest first), so that the match finding will pick
+ // longer matches before shorter matches, since it might match both, but the longer match is more
+ // precisely what we are looking for.
+ const sanitizedExportPathsSortedByLength = sanitizedExportPaths.sort((a: string, b: string) => {
+ return b.length - a.length;
+ });
+ const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPathsSortedByLength, p => {
return _.startsWith(typeDocNameWithoutQuotes, p);
});
if (_.isUndefined(matchingSanitizedExportPathIfExists)) {