Yarn: Licence generateDisclaimer - Outputs "junk" to stdout

Created on 18 Oct 2016  ·  3Comments  ·  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Bug

What is the current behavior?
When running yarn licenses generateDisclaimer and piping stdout to a file, I would expect to get only the disclaimer text to easily integrate this feature with CI etc. Instead, the first few lines look like this:

yarn licenses v0.15.1
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE XXX PRODUCT.

The third line is correct, but the two proceeding have nothing to do with the disclaimer.

At the end of the document, there is a line that says

Done in 5.45s.

This is also not a part of the disclaimer and should not be a part of the output.

I see four possible solutions.

  • The first is to send all metadata about yarn to stderr
  • The second is to specially handle generateDisclaimer
  • The third is to create a global -q, --quiet flag
  • The last is to add a -o --output option to generateDisclaimer that writes a file

If the current behavior is a bug, please provide the steps to reproduce.

  1. Create a package.json with some dependencies (preferably with some incompatible peerDependencies)
  2. Run yarn licenses generateDisclaimer > DISCLAIMERS.txt
  3. Open DISCLAIMERS.txt
  4. Look at the beginning and end of the document

What is the expected behavior?
The disclaimer file is generated without the parts preceding THE FOLLOWING SETS FORTH ATTRIBUTION, and without Done in 5.45s. at the end.

Please mention your node.js, yarn and operating system version.

$ yarn --version
0.15.1
$ node --version
v6.4.0
$ uname -a
Linux thor.osl.manamind.com 4.7.7-200.fc24.x86_64 #1 SMP Sat Oct 8 00:21:59 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
cat-feature

Most helpful comment

Hi All, I seem to still have this problem:

$ yarn --version
0.22.0
$ yarn licenses generate-disclaimer > test.out
warning [email protected]: No license field
warning [email protected]: The platform "darwin" is incompatible with this module.
warning [email protected]: The platform "darwin" is incompatible with this module.
warning package.json: No license field
$ head test.out
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE CASTBRIDGE PRODUCT.
...

Is there any way to fix this? Thanks!

NINJA EDIT: I can run yarn licenses generate-disclaimer --ignore-platform, and that does do what I want, but I don't think that's the intended use pattern. (I could be wrong)

All 3 comments

I'd like to start contributing so I'm going to work on this.

Created #1586 to fix this, pending approval.

Hi All, I seem to still have this problem:

$ yarn --version
0.22.0
$ yarn licenses generate-disclaimer > test.out
warning [email protected]: No license field
warning [email protected]: The platform "darwin" is incompatible with this module.
warning [email protected]: The platform "darwin" is incompatible with this module.
warning package.json: No license field
$ head test.out
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE CASTBRIDGE PRODUCT.
...

Is there any way to fix this? Thanks!

NINJA EDIT: I can run yarn licenses generate-disclaimer --ignore-platform, and that does do what I want, but I don't think that's the intended use pattern. (I could be wrong)

Was this page helpful?
0 / 5 - 0 ratings