feat: add switch to add license text to BOM result#427
feat: add switch to add license text to BOM result#427CompartMSL wants to merge 2 commits intoCycloneDX:mainfrom
Conversation
99f9dde to
1d348e9
Compare
1d348e9 to
b27a3fe
Compare
|
❌ Please add proper tests. PS: this is already ongoing |
b27a3fe to
b20daa5
Compare
Signed-off-by: Matthias Schiebel <msl@compart.com>
217a4c8 to
b53631e
Compare
tests/_data/dummy_projects/with-lockfile/node_modules/my-local-a/LICENSE
Outdated
Show resolved
Hide resolved
|
Based on the proposed implementation, the new switch The @CompartMSL, how do you see this? |
7627101 to
b53631e
Compare
You are right. |
|
Ignore the tests for a while, and just take care of the needed implementation details. |
src/licensetexts.ts
Outdated
| if (pkgPath.length < 1) { | ||
| return licenseFilenamesWType | ||
| } | ||
| const typicalFilenames = ['LICENSE', 'License', 'license', 'LICENCE', 'Licence', 'licence', 'NOTICE', 'Notice', 'notice'] |
There was a problem hiding this comment.
Please change the list/implementation to be case-insensitive.
I'd suggest having only lowercased entries in the list.
I'd suggest using a scandir-like behavior where all files are lowercased before they are compared against the list of known files.
There was a problem hiding this comment.
I chose the other way first to get a list of all files and match case-insensitive. Maybe there is later an idea to handle multiple files
|
converted PR to "draft", since the implementation is not final, yet. |
d0c1d1c to
2efa5b7
Compare
Signed-off-by: Matthias Schiebel <msl@compart.com>
2efa5b7 to
cf882a1
Compare
|
|
||
| import { Enums, Models } from '@cyclonedx/cyclonedx-library' | ||
| import * as fs from 'fs' | ||
| import * as minimatch from 'minimatch' |
There was a problem hiding this comment.
❓ where does this come from?
| myConsole | ||
| ).buildFromProjectDir(projectDir, process) | ||
|
|
||
| if (options.addLicenseText) { |
There was a problem hiding this comment.
Why do this after everything is set?
I'd suggest putting the code in the existing BomBuilder.makeComponent()
|
@CompartMSL I find the proposed current implementation disturbing, as it does not stick to chosen design principles and architecture of this project. my suggestion: write the needed function and usage in the
|
| * @param {Models.DisjunctiveLicense} license | ||
| * @param {string} installPath | ||
| */ | ||
| function addLicTextBasedOnLicenseFiles (license: Models.DisjunctiveLicense, installPath: string): void { |
There was a problem hiding this comment.
license text detection is not completely solved.
Therefore, the result shall be an evidence, rather than n license attachment.
As suggested in CycloneDX#427 (comment) Signed-off-by: Christoph Uhland <42832096+cuhland@users.noreply.github.com>
|
I want to support this feature and created a branch which took these commits here, rebased them on top of current main and did soome refactoring regarding the code structure. |
I do not see a good to merge the current state of this very PR. If you have a maintained version of it, feel free to open a competing pull-request. Since this feature is nothing new, there is no need to reinvent the wheel. It is expected to simply copy existing art.
just in case: Please keep the scope of your PR, don't mix unrelated changes into a feature-PR |
|
Superseded by #1243 |
fixes #256