Skip to content

Commit

Permalink
fix: try parent name if model name is index
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Dec 3, 2023
1 parent f2e91fa commit 78a9e6b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/docs/readme-updater-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,20 @@ export function load (app) {
}

if (isMonorepoParent) {
let project = urlMapping.model.name

if (project === 'index' && urlMapping.model.parent != null) {
project = urlMapping.model.parent?.name
}

if (projects[project] == null) {
throw new Error(`Could not derive project name from url mapping model "${urlMapping.model.name}" with parent "${urlMapping.model.parent?.name}"`)
}

return {
comment: urlMapping.model.comment,
manifestPath: path.join(projects[urlMapping.model.name].dir, 'package.json'),
readmePath: path.join(projects[urlMapping.model.name].dir, 'README.md')
manifestPath: path.join(projects[project].dir, 'package.json'),
readmePath: path.join(projects[project].dir, 'README.md')
}
}

Expand Down

0 comments on commit 78a9e6b

Please sign in to comment.