-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Filter yarn deps to direct deps for main package #1623
base: master
Are you sure you want to change the base?
Filter yarn deps to direct deps for main package #1623
Conversation
When creating the dependency list for the main package in yarn.lock parsing, filter to only include direct dependencies from package.json. This ensures the dependency graph accurately represents direct vs transitive dependencies. Previously all dependencies were being added as direct dependencies for the main package, which was incorrect. Now we read package.json to determine which dependencies are actually direct dependencies. Signed-off-by: Sahil Seth <sseth@atlassian.com> Signed-off-by: sseth <sseth@atlassian.com>
Please let me know your thoughts on this and we can also make minor adjustments to the code, if required. |
@prabhu could you please take a look at this since this is kinda blocking us due to the extra dependencies? |
Sorry. I had my head buried in the last few weeks. Please take my email to avoid delays in the future (prabhu at appthreat dot dev). |
Could you kindly run |
@@ -2873,9 +2873,15 @@ export async function createNodejsBom(path, options) { | |||
} | |||
const rdeplist = []; | |||
if (parsedList.dependenciesList && parsedList.dependenciesList) { | |||
// copyright (c) 2025 Atlassian US, Inc. |
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.
Can you remove this copyright comment?
@@ -2873,9 +2873,15 @@ export async function createNodejsBom(path, options) { | |||
} | |||
const rdeplist = []; | |||
if (parsedList.dependenciesList && parsedList.dependenciesList) { | |||
// copyright (c) 2025 Atlassian US, Inc. | |||
// First read package.json to get direct dependencies | |||
const pkgData = JSON.parse(readFileSync(packageJsonF, "utf8")); |
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.
Should we move this logic to outside the for loop? Also how would this work in monorepos with multiple package.json and yarn.lock files?
@sahil-seth we need to test this with monorepos etc. We are not there yet I'm afraid. |
This is related to #1085
Context:
yarn list --depth=0
which is also incorrect and has been acknowledged hereChanges:
package.json
filedependenciesList
and only adding direct ones to the main packageSigned-off-by: Sahil Seth sseth@atlassian.com