-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dependency analysis script (#4548)
* Initial port of template to Handlebars * Collect dependency info from package.jsons * Generate inconsistent dependency info * Remove lockfile processing * eslint and prettier * Sort everything in the HTML report * Exclude from docwarden
- Loading branch information
Showing
5 changed files
with
647 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>{{ capitalize repo_name }} Dependency Report</title> | ||
<meta charset="UTF-8" /> | ||
<style> | ||
body { | ||
font-family: Verdana, sans-serif; | ||
font-size: 14px; | ||
text-size-adjust: none; | ||
} | ||
table { | ||
border-spacing: 0px; | ||
width: 65%; | ||
font-size: 14px; | ||
} | ||
table.condensed tr td { | ||
padding: 7px 15px; | ||
} | ||
th, | ||
td { | ||
padding: 15px; | ||
border-bottom: 1px solid #ddd; | ||
vertical-align: top; | ||
} | ||
tr:nth-child(even) { | ||
background-color: #f2f2f2; | ||
} | ||
th { | ||
background-color: #2E7CAF; | ||
color: white; | ||
font-weight: 300; | ||
text-align: left; | ||
} | ||
th a { | ||
color: white; | ||
} | ||
th.inconsistent { | ||
background-color: #FF0000; | ||
} | ||
td.version { | ||
width: 75px; | ||
} | ||
.tooltip { | ||
position: relative; | ||
display: inline-block; | ||
border-bottom: 1px dotted black; | ||
} | ||
.tooltip .tooltiptext { | ||
visibility: hidden; | ||
background-color: black; | ||
color: #fff; | ||
white-space: nowrap; | ||
text-align: left; | ||
padding: 5px; | ||
font-size: 14px; | ||
position: absolute; | ||
z-index: 1; | ||
margin-top: 7px; | ||
top: 100%; | ||
left: 0%; | ||
} | ||
.tooltip .tooltiptext::after { | ||
content: " "; | ||
position: absolute; | ||
bottom: 100%; | ||
/* At the top of the tooltip */ | ||
left: 5%; | ||
margin-left: -5px; | ||
border-width: 5px; | ||
border-style: solid; | ||
border-color: transparent transparent black transparent; | ||
} | ||
.tooltip:hover .tooltiptext { | ||
visibility: visible; | ||
} | ||
.success { | ||
color: #00CC00; | ||
} | ||
.fail { | ||
color: #CC0000; | ||
} | ||
.dep_type { | ||
border: 1px solid gray; | ||
border-radius: 2px; | ||
background: lightgray; | ||
font-size: 10px; | ||
padding: 1px 2px; | ||
} | ||
.dep_type.runtime { | ||
border-color: forestgreen; | ||
background: lightgreen; | ||
} | ||
.dep_type.peer { | ||
border-color: cadetblue; | ||
background: lightblue; | ||
} | ||
@media only screen and (max-width: 1350px) { | ||
body, | ||
table { | ||
font-size: 25px; | ||
} | ||
table { | ||
width: 95%; | ||
} | ||
td.version { | ||
width: 35px; | ||
} | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<center> | ||
<h1>{{ capitalize repo_name }} Dependency Report</h1> | ||
<h3> | ||
Generated at {{ curtime }} | ||
{{#if release}} | ||
for release <a href="{{ rel_url }}">{{ release }}</a> | ||
{{else if build}} | ||
for build <a href="{{ build_url }}">{{ build }}</a> | ||
{{#if branch}} | ||
<br />from branch <a href="https://github.com/{{ repo }}/tree/{{ branch }}">{{ branch }}</a> | ||
{{#if isfork}} | ||
in repo <a href="https://github.com/{{ repo }}">{{ repo }}</a> | ||
{{/if}} | ||
{{/if}} | ||
{{#if commit}} | ||
(<a href="https://github.com/{{ repo }}/commit/{{ commit }}">{{ truncate commit 7 }}</a>) | ||
{{/if}} | ||
{{/if}} | ||
</h3> | ||
<p> | ||
{{ sub (len dependencies) (len external) }} internal and {{ len external }} external package <a href="#dependencies">{{ pluralize (len dependencies) 'dependency</a> was' 'dependencies</a> were' }} analyzed to determine if any packages declare inconsistent dependency versions.<br /> | ||
{{#if inconsistent}} | ||
<strong>{{ len inconsistent }} inconsistent package dependency {{ pluralize (len inconsistent) 'version was' 'versions were' }} discovered.</strong><br /><br /> | ||
{{else}} | ||
No inconsistent package dependency versions were discovered.<br /><br /> | ||
{{/if}} | ||
<br />This report scanned {{ len packages }} <a href="#packages">{{ pluralize (len packages) 'package' 'packages' }}</a>. | ||
</p> | ||
<a name="dependencies" /> | ||
{{#each (sorted dependencies) as |dep|}} | ||
<a name="dep_{{dep.[0]}}" /> | ||
<table> | ||
<thead> | ||
{{#if @first}} | ||
<tr> | ||
<th colspan="2"><strong>Dependencies Discovered in Packages</strong></th> | ||
</tr> | ||
{{/if}} | ||
<tr> | ||
<th colspan="2" class="{{dep_type dep.[0]}}"><strong>{{ title (dep_type dep.[0]) }} Dependency:</strong> {{ dep.[0] }}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each (sorted dep.[1]) as |spec|}} | ||
<tr> | ||
<td class="version">{{ default spec.[0] '(empty)' }}</td> | ||
<td> | ||
{{#each (sorted spec.[1]) as |package|}} | ||
{{ package.[0] }} <span class="dep_type {{ package.[1] }}">{{ package.[1] }}</span><br /> | ||
{{/each}} | ||
</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
<br /> | ||
{{/each}} | ||
<br /><br /> | ||
<hr /><br /><br /> | ||
<a name="packages" /> | ||
<table class="condensed"> | ||
<thead> | ||
<tr> | ||
<th colspan="3"><strong>Packages Scanned for this Report</strong></th> | ||
</tr> | ||
<tr> | ||
<th>Package Analyzed</th> | ||
<th>Package Version</th> | ||
<th>Package Source</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each (sorted packages) as |entry|}} | ||
<tr> | ||
<td>{{ entry.[0] }}</td> | ||
<td>{{ entry.[1].ver }}</td> | ||
<td>{{ entry.[1].src }}</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
</center> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.