Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to save the results of `yarn audit` to a text file?

Tags:

yarnpkg

I have tried using yarn-audit-html but it outputs a .html file.

I would like the output audit table results from the audit in a text or json file.

Here is the data I am looking for: enter image description here

Note: copy/paste from the terminal is not an option because of the # of results that are returned.

like image 807
Katherine R Avatar asked Jan 27 '23 03:01

Katherine R


1 Answers

You can redirect the output of yarn audit into a file on the command line.

yarn audit > audit-output.txt

The default output of audit contains lots of color sequences that make it difficult to read but could probably be stripped out in post-processing. To get the output as JSON, add the --json flag.

yarn audit --json > audit-output.json
like image 149
doelleri Avatar answered Jan 28 '23 18:01

doelleri