-
Notifications
You must be signed in to change notification settings - Fork 14
Use explicitlyReferencedComponentIds to determine which packages are direct #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In my test repo, this works as expected 🎉 What I'm still concerned about:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
This does feel a bit more robust that the top level referrers logic we previously went with. The trade off being now we have to worry about file path conversions
if (referrerPackage === pkg) { | ||
core.debug(`Skipping self-reference for package: ${pkg.id}`); | ||
return; // Skip self-references | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New code to eliminate self-referential paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes look good. Thanks!
This is a big change from how we've been doing this, but it's much more likely to be accurate.
We typically consider a dependency direct iff it is explicitly listed as a dependency at the top level. The
explicitlyReferencedComponentIds
field in the Component Detection output corresponds to this, so it should be the only thing we need to check when determining if a dependency is direct or transitive.The main risk here as I see it is an unfortunate difference in the way paths are represented in that section (
dependencyGraphs
) vs later on in the components:vs
So most of the time, manifest paths are given relative to the repository root. In
dependencyGraphs
, they're given as absolute filesystem paths. That creates the risk that we'll mess up the mapping from one to the other. For now, I think the way I've written this is likely to work, but it's a little risky still.