CLI: new licences command (#5690)

* new licences command

* remove old licences command
This commit is contained in:
Denys Vuika
2020-05-12 19:56:45 +01:00
committed by GitHub
parent b32f3f7f01
commit 6793c5c466
5 changed files with 208 additions and 115 deletions

View File

@@ -0,0 +1,31 @@
---
Title: Audit info, <%= projName %> <%= projVersion %>
---
# Audit information for <%= projName %> <%= projVersion %>
This page lists the npm audit of the project in the version <%= projVersion %>
## Risks
- Critical risk dependencies <%= jsonAudit.metadata.vulnerabilities.critical %>
- High risk dependencies <%= jsonAudit.metadata.vulnerabilities.high %>
- Moderate risk dependencies <%= jsonAudit.metadata.vulnerabilities.moderate %>
- Low risk dependencies <%= jsonAudit.metadata.vulnerabilities.low %>
Dependencies analyzed <%= jsonAudit.metadata.totalDependencies %>
## Libraries
| Severity | Vulnerable versions | Module |
| --- | --- | --- |
<%
for(var currentAdvisories in jsonAudit.advisories) {
severity = jsonAudit.advisories[currentAdvisories].severity;
vulnerable_versions = JSON.stringify(jsonAudit.advisories[currentAdvisories].vulnerable_versions);
module = jsonAudit.advisories[currentAdvisories].module_name;
-%>
|<%= severity %> | <%= vulnerable_versions %> | <%= module %> |
<% } %>

View File

@@ -0,0 +1,28 @@
---
Title: License info, <%= projName %> <%= projVersion %>
---
# License information for <%= projName %> <%= projVersion %>
This page lists all third party libraries the project depends on.
## Libraries
| Name | Version | License |
| --- | --- | --- |
<% for (var packageName in packages) {
var lastAtSignPos = packageName.lastIndexOf('@');
var name = packageName.substring(0, lastAtSignPos);
var version = packageName.substring(lastAtSignPos + 1);
var pack = packages[packageName];
var licenses = pack['licenseExp'] || 'N/A';
var repo = pack['repository'];
var linkedName = name;
if (repo) {
linkedName = `[${name}](${repo})`
}
-%>
| <%= linkedName %> | <%= version %> | <%= licenses %> |
<% } %>