fix: check dependencyGraph root for version info #507
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What did you implement:
fixes: #506
Version information of linked dependencies (e.g.
link:../../packages/logger
) could not be resolved resulting in the warning message"WARNING: Could not determine version of module XXX"
.How did you implement it:
Add an additional fallback to retrieve dependency version from the root of the dependencyGraph.
When analysing the current fallback code, the current implementation will never work in my workspace since
yarn list --depth=1
(called throughpackager.getProdDependencies(path.dirname(packageJsonPath), 1)
) will never contain version information insidedependencyGraph.dependencies.${module.origin}.dependencies
since that would require a depth greater than 1.Note. I did add a
eslint-disable-next-line
comment so I was able to use an array as path to circumvent bugs when the package name contains a.
(e.g.lodash.memoize
)How can we verify it:
The workspace for which this PR resolves this warning has the following (or similar) structure
Todos:
Is this ready for review?: YES
Is it a breaking change?: NO