-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Generating bom for a mixed project includes devDependencies when using --required-only
#1598
Comments
@Torbjorn-Svensson This is a good bug. It appears like the parseYarnLock method isn't attempting to set the scope attribute. Line 1699 in ea63d5c
In such cases, if the complete source code were present, then the babel-based usage analysis might have helped. Are you running cdxgen with just the lock file without the source code? In such cases, the logic could be improved to use the package.json to mark optional packages. |
I've tried generating the bom after running |
Needs some triaging. Have to print the values here and see what is going on. Line 2288 in e2613ad
Have you tried simple things like passing an absolute path to the current directory to cdxgen? Add |
I did some debugging last Friday before opening this issue and from what I can tell, Supplying a relative or an absolute path does not matter. I'm trying to work out how to run cdxgen to get the right content for a few different projects.
So, as you can see, the bom content depends on what extra options you called Note, in all my trails, I've used the same command line options to cdxgen (only thing changed is the way to install the deps and relative/absolute/no path given to cdxgen). |
Sorry, didn't read your original comment entirely. This confirms my theory. Yes, we need an enhancement to fall back to using package.json. Will keep this issue open. |
In some of our deliverables, we use a combination of package.json and Cargo.toml.
The reason for the mix is that we want to use some tools to format and check files in the delivery (among other releng things).
Note: We are not using the package.json for the delivery, only as a means to ensure we have the right tools.
Example package.json:
To ensure reproducibility, we also have the corresponding
yarn.lock
file in our repository.When running
cdxgen
on this type of setup, everything in the yarn.lock file is consider a required dependency. Is this expected?From what I can tell, the reason why prettier, from my example above, is considered a required dependency is that there is no import or exports detected (since there is no sources for this package).
cdxgen is invoked with
--deep --fail-on-error --required-only
.From my POV, I do not expect prettier to be listed in the bom as it's a dev-dependency, but maybe I'm wrong here?
The text was updated successfully, but these errors were encountered: