Is there a way to display the npm audit report as an html page?
At the moment i can only see the option to output the report in json format, using this command:
npm audit --json
Is there a way to display the npm audit report as an html page?
At the moment i can only see the option to output the report in json format, using this command:
npm audit --json
I wrote an NPM package that does this for you.
You can use it by running the following:
// first install it
npm i -g npm-audit-html
// then pipe npm audit to it
npm audit --json | npm-audit-html
cmd /c 'npm audit --json | npm-audit-html'
–
Westernism npm-audit-html is a good package, just used it.
npm install -g npm-audit-html
npm audit --json | npm-audit-html --output report.html
If you are getting the "No Input" response when running through powershell or VS Code Terminal just run it with the command prompt
npm-audit.html
. –
Cleruchy Following previous answers...
As of NPM v7, you'll need the beta version of npm-audit-html
.
npm install -g npm-audit-html@beta
npm audit --json | npm-audit-html --output report.html
For more details: https://github.com/eventOneHQ/npm-audit-html/issues/43#issuecomment-940159989
P.S. Tested with NPM v8.3.0.
On Linux I'm using ccat in a bash script:
#!/bin/sh
echo "<!DOCTYPE html><head><meta charset=\"UTF-8\"/></head><body>"
npm audit|ccat --html
echo "</body></html>"
Usage: ./audit.sh > vulnerabilities.html
But I'm also interested in other solutions, maybe ones that could work on Windows too.
© 2022 - 2024 — McMap. All rights reserved.