mhassan1 / yarn-plugin-licenses

Yarn Berry plugin that adds `yarn licenses` commands
42 stars 11 forks source link

Recursive report does not work #14

Closed mpetuska closed 2 years ago

mpetuska commented 2 years ago

When trying to list licenses recursively, the following error is thrown.

Type Error: n.map is not a function
        at /.yarn/plugins/@yarnpkg/plugin-licenses.cjs:6:4355

Environment:

mhassan1 commented 2 years ago

Interesting. That error is coming from here: https://github.com/mhassan1/yarn-plugin-licenses/blob/4989eb27f5724df26d84f09756b2b16665dd5358/src/utils.ts#L191-L197

My guess is it is not handling the case where one of the dependencies has licenses as a string. Even though that is not a valid configuration, we should handle it. Can you share a yarn.lock file so I can try to replicate?

mpetuska commented 2 years ago

I can't unfortunately as it's an enterprise project. But here are some key points of our setup:

mhassan1 commented 2 years ago

I've just pushed up a branch that I believe will fix the issue. Can you run yarn plugin import https://raw.githubusercontent.com/mhassan1/yarn-plugin-licenses/consider-string-licenses/bundles/@yarnpkg/plugin-licenses.js and try again?

mpetuska commented 2 years ago

I can confirm that it works, thanks. Can you hold off closing this issue until the fix is merged into master, please?

mhassan1 commented 2 years ago

Merged and released as v0.7.2