-
-
Notifications
You must be signed in to change notification settings - Fork 23
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 support for targetting specific workspaces #1212
feat: add support for targetting specific workspaces #1212
Conversation
4ac8c52
to
a26d8da
Compare
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 things require chen. see my remarks.
also, please add proper unit tests
Happy to do the changes. I would think some integration tests would be required for this change as it is not really feasible to test it in isolation due to the logic effectively sitting on the I agree with the requirement of testing. I spent some time initially before making the PR going through the existing unit and integration tests and it is not very clear to me how we should go about adding tests for new functionality. For example, I do not see tests for several of the CLI options (such as Could you provide a bit of a guide regarding how we should lay out tests for new functionality going forward as well as a brief of how the existing integration tests work and how they are structured. I intend on making additional PRs in the future for other issues and features so this would be very beneficial for me (and I'm sure other community members). |
@MalickBurger, for adding additional integration tests,
since you are planning on adding conditional parameters in the |
caused by #1212 --------- Signed-off-by: Jan Kowalleck <[email protected]>
Looking at this, could you provide some testing support for an existing argument that is passed to |
will do. just bare with me, it may take a while |
I am currently working on a solution. Will ping as soon as I have something for you. |
I've overhauled the integration tests. you might add something like // region workspace
['workspace not supported npm 6', `6.${rMinor}.${rPatch}`, ['--workspace my-wsA', '--workspace my-wsB'], [...npm6ArgsGeneral]],
['workspace npm 7', `7.${rMinor}.${rPatch}`, ['--workspace my-wsA', '--workspace my-wsB'], [...npm7ArgsGeneral, '--workspace my-wsA', '--workspace my-wsB']],
['workspace npm 8', `8.${rMinor}.${rPatch}`, ['--workspace my-wsA', '--workspace my-wsB'], [...npm8ArgsGeneral, '--workspace my-wsA', '--workspace my-wsB']],
['workspace npm 9', `9.${rMinor}.${rPatch}`, ['--workspace my-wsA', '--workspace my-wsB'], [...npm9ArgsGeneral, '--workspace my-wsA', '--workspace my-wsB']],
['workspace npm 10', `10.${rMinor}.${rPatch}`, ['--workspace my-wsA', '--workspace my-wsB'], [...npm10ArgsGeneral, '--workspace my-wsA', '--workspace my-wsB']]
// endregion workspace PS: i've also prepared demo data for additional integration tests. I might add them as soon as the basic pass-through tests are done |
d95dee9
to
052b2a6
Compare
052b2a6
to
e7c1f1d
Compare
@MalickBurger , i see you've rebased this feature branch recently. |
Hi @jkowalleck, yes I have been busy recently but am getting back to this now. Will be posting updates soon. |
e7c1f1d
to
a5ff5bc
Compare
merged in the latest master, fixed some merge conflicts. |
Will take a look and update over the next few days when I have a chance |
ae6e4d3
to
a300d13
Compare
seams like some tests are failing. |
4b610a3
to
99114f6
Compare
Should be resolved now. |
i am considering this feature to be integrated and marked as "experimental". |
99114f6
to
8e86e56
Compare
Hi @jkowalleck just want to find out where we stand regarding this PR. From my side I believe it is ready to merge. |
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.
something seams not 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.
i think some parts need discussion
I think we are conflicting slightly on how this should be implemented because I am trying to design this in a way that is the most intuitive and yet still flexible experience for users. The aim is for it to be clear what the default behaviour is and how they can modify this behaviour if they wish. The way you would like this done is to mimic npm ls exactly which I still don't fully understand since most users of the plugin wouldn't really care how the internals work they just want a tool that can create sboms for npm projects as easily as possible. In an ideal world we could both have our way but I don't think it is the case here because the behaviour of npm ls with regards to workspaces is non intuitive and a bit of a black box (it also changes between version 7 and newer versions). Before I go back and rewrite the logic again let's please fully decide how this is going to look, how we are going to explain it to users, and what default logic will be for all combination of workspace related parameters. |
This PR and a reading I had the idea to mimic My idea was to go the "easy" path - from a product owner's perspective - as all responsibility would be shifted to the users. Especially with workspaces, I would expect to have experienced users who knew what they do. I think I understand your point, and you convinced me. After the implementation is done, we might see which kind of test data is required and how it can be provided. |
@MalickBurger and @jkowalleck what is the status here? I would like to use the cyclonedx-node-npm with some projects that uses npm workspaces. Let me know if I can help here in any way. I will try, the branch build on my projects for now. |
Hi @mapau, I will be getting back to this later in the week, we are close (hopefully) to having this PR finalized. Happy if you would consider doing some testing once complete? |
11817e0
to
02824c2
Compare
Hi @jkowalleck, I have refactored my changes based on our last discussion. I have simplified the logic and have tried to make it as simple and intuitive as possible to users while still mimicking npm ls where possible. I have designed it in such a way that users do not need to have an indepth understanding of npm ls or knowledge on which version they are running. I have updated the tests but I need to do a few manual sanity tests as well however I will wait for now incase I need to make any additional changes. |
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.
i have only implementation-related remarks.
the UX looks good.
what do you think, @mapau?
@jkowalleck I used the branch build on my projects that used npm workspace. All works as expected. The CLI help and info is clear and I would use this version as it is. Only small thing, on my zsh the help output from the --no-workspaces section is not aligned with the other, see screenshot. ![]() |
Signed-off-by: MalickBurger <[email protected]>
02824c2
to
df3cdf0
Compare
Thanks for testing it out and providing feedback. I have made a change for the formatting issue and it is fixed. |
love the result. will merge soon. Thank you very much for your persistence and championing this feature, @MalickBurger. cyclonedx-node-npm/package.json Line 39 in 15da89b
|
|
caused by #1212 (comment) Signed-off-by: MalickBurger <[email protected]>
fixes #1126