Skip to content

Commit 78a9e6b

Browse files
committed
fix: try parent name if model name is index
1 parent f2e91fa commit 78a9e6b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/docs/readme-updater-plugin.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,20 @@ export function load (app) {
4949
}
5050

5151
if (isMonorepoParent) {
52+
let project = urlMapping.model.name
53+
54+
if (project === 'index' && urlMapping.model.parent != null) {
55+
project = urlMapping.model.parent?.name
56+
}
57+
58+
if (projects[project] == null) {
59+
throw new Error(`Could not derive project name from url mapping model "${urlMapping.model.name}" with parent "${urlMapping.model.parent?.name}"`)
60+
}
61+
5262
return {
5363
comment: urlMapping.model.comment,
54-
manifestPath: path.join(projects[urlMapping.model.name].dir, 'package.json'),
55-
readmePath: path.join(projects[urlMapping.model.name].dir, 'README.md')
64+
manifestPath: path.join(projects[project].dir, 'package.json'),
65+
readmePath: path.join(projects[project].dir, 'README.md')
5666
}
5767
}
5868

0 commit comments

Comments
 (0)