-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: add rootComponentVCS configuration #1350
Conversation
resolves CycloneDX#1344 Signed-off-by: Jeremy Long <[email protected]>
Signed-off-by: Jeremy Long <[email protected]>
"comment": "as detected from PackageJson property \\"bugs.url\\"" | ||
}, | ||
{ | ||
"url": "git+https://github.com/CycloneDX/cyclonedx-webpack-plugin.git#tests/integration/feature-issue1344-no-detect", |
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.
is this not expected to be overridden via config, right?
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.
We do not override based on the config. I specifically stated in the documentation that it would only be set if autodetect was disabled or a VCS was not defined in the package.json. I'm okay if we change this behavior.
This comment was marked as resolved.
This comment was marked as resolved.
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.
some smaller nitpicks here and there but overall,
this feature seams to be good to go.
Co-authored-by: Jan Kowalleck <[email protected]> Signed-off-by: Jeremy Long <[email protected]>
Signed-off-by: Jeremy Long <[email protected]>
Signed-off-by: Jeremy Long <[email protected]>
Signed-off-by: Jeremy Long <[email protected]>
src/plugin.ts
Outdated
@@ -328,6 +336,18 @@ export class CycloneDxWebpackPlugin { | |||
) | |||
logger.debug('Added rootComponent BuildSystem URL:', this.rootComponentBuildSystem) | |||
} | |||
if (typeof this.rootComponentVCS === 'string' && | |||
this.rootComponentVCS.length > 0 && | |||
!component.externalReferences.values().some(ref => ref.type === CDX.Enums.ExternalReferenceType.VCS)) { |
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.
sorry, i proposed an invalid optimization here.
TIL Iterator.prototype.some()
is not available on platforms this tool intends to support.
node 14.0.0 to node 21.0.0
(new Set([1,2,3])).values().some(i => i === 1)
Uncaught TypeError: (new Set([1,2,3])).values(...).some is not a function
added a polyfill for this purpose: 7ce6946
Signed-off-by: Jan Kowalleck <[email protected]>
Thank you for donating this feature, @jeremylong |
this feature was released via https://github.com/CycloneDX/cyclonedx-webpack-plugin/releases/tag/v3.17.0 |
@jkowalleck thank you! |
@jkowalleck I know you indicated you would not accept adding the configuration for
rootComponentVCS
. However, becauseauto-detect
can be disabled or the VCS may not be defined in thepackage.json
- this feature is important. This feature is essential for me as the pipeline I am using injects several configurations on the fly; I may not have control over what a developer does with the package.json - but I can ensure the pipeline correctly adds the VCS if it is not defined.In the spirit of the open-source license, I'm providing the code changes to implement the feature. I'm hoping you will accept this PR so that I do not have to maintain an internal fork of your project.
resolves #1344