-
Notifications
You must be signed in to change notification settings - Fork 16
Support monorepo and workaround local dependencies #104
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
base: main
Are you sure you want to change the base?
Conversation
It should probably just omit anything that's a file dep, no? |
I'd support just ignoring, but I have no idea whether or how Arborist handles such deps. |
Arborist handles them fine, but I mean because it's first-party code so the license isn't relevant. |
Unfortunately we encountered 3rd party package which ships third party packages this way 🤦 So we still had to verify manually if license is OK |
I'm confused, the third-party package contains a file: dep, that's also contained in the package? and that tablesorter thing has a package.json? |
wow, that is horrific - vendoring code anywhere has been a bad practice for a long time, and doing it in a package is, as this shows, very problematic with tooling, especially security tooling. In this case, though, the vendored deps don't even seem to have a package.json, so there's no license information to be found - it's useless for this tool (in-code comments aren't statically discoverable). So I still think just unilaterally skipping file deps is the right move. I also note that I can't even find a live version of that package with tablesorter in it (it may exist, i only checked the latest and earliest in each major, v5-v9). What version are you using? |
We do not use tablesorter. This is dependency coming from the package. Looks like some of those symlinks are even dead |
Right, but that's what i mean - the package doesn't actually have tablesorter in it. |
Yep. Anyway, about PR, should I move forward with docs and tests updates? Any remarks? |
I think a bug fix to not crash with cases like this is great and uncontroversial. I’m not as convinced about a new option. |
A test inducing a crash would be welcome. Preferably one that writes out a package.json causing the issue, rather than pulling in unrelated packages from npm. |
Added unit test, which proves things will not explode if bad package is added. What I discovered in the process, is that symlink leading to non existing file is causing the issue. Can you also add filtering by path? It is good for exactly such case. |
Fixed unit test (test was failing because of |
If you are OK with those changes, I can update documentation and tests.
While trying to use it, I encountered few issues:
1. Some packages define dependencies as paths to files
Ex.
"tablesorter": "file:./src/js-vendor/tablesorter"
🤦a) Such package does not have metadata (name, license). So sorting by name was failing. Added check, to sort only if all packages have names.
b) Lack of metadata was also causing impossible to ignore such packages. Added
ignorePath
option to ignore by path2.Reusing
licensee()
in monorepo in loop over multiple paths topackage.json
was not workinga)
configuration
object was kept in memory , meaning it was processed few times, resulting in errors. Now method createsstructuredCopy
of original, before processing it.b) It was impossible to wait for
licensee()
execution, despite method being sync. Marked as async, and now it will return promise, , which at the end returns callback. This allows more custom processing of a result.Attaching example of TS using this (renamed to txt because Github):
license.txt