Skip to content

Commit

Permalink
Add Newtonsoft.Json package reference and update version***
Browse files Browse the repository at this point in the history
***Add MaxUpStreamReferences property to ProjectsDict class***
***Update Newtonsoft.Json package version in NetPackageAnalyzerDocusaurus.csproj***
***Update DisplayAllVersionsForMarkdown.cshtml to highlight major version differences***
***Update MermaidVisualizerMajorDiffer.cshtml to change heading***
***Update SolutionRelations.cshtml to include number of projects and quadrant relations
  • Loading branch information
ignatandrei committed Mar 11, 2024
1 parent 408631a commit d8a5f50
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<None Include="..\..\..\README.md" Link="README.md" Pack="true" PackagePath="\" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<None Include="..\..\..\docs\ico.png" Pack="true" PackagePath="\" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
<ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions src/NetPackageAnalyzer/NetPackageAnalyzerObjects/ProjectsDict.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ public long MaxPackages
return this.Values.Select(it => it.Packages.Count).Max();
}
}
public long MaxUpStreamReferences
{
get
{
return this.
Values
.Select(it => it.UpStreamProjectReferences.Count)
.Max();
}
}

public long MaxReferences
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RazorBlade" Version="0.4.3" PrivateAssets="all" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
<PackageReference Include="ThisAssembly.AssemblyInfo" Version="1.4.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
@inherits RazorBlade.HtmlTemplate<DisplayDataMoreThan1Version>;
@inherits RazorBlade.PlainTextTemplate<DisplayDataMoreThan1Version>;
@{
var keysPackageMultiple = Model.KeysPackageMultiple();
}
---
sidebar_position: 30
---

export const Highlight = ({children, color}) => (
<span style={{
backgroundColor: color,
borderRadius: '2px' ,
color: '#fff' ,
padding: '0.2rem' ,
}}>
{children}
</span>
);


# Packages

## Number of packages : @Model.NrPackages()
Expand All @@ -25,16 +38,16 @@ sidebar_position: 30
var vals = pack.VersionsPerProject;
var majorDiff = pack.MajorVersionDiffer();
string textReferences = vals.Count > 1 ? $" *(References: {vals.Count})* " : "";
string diffMajor = majorDiff ? $" **Major differs** " : "";
string diffMajor = majorDiff ? $"<Highlight color='red'> **Major differs** </Highlight>" : "";
string refs = "";
@foreach (var vers in vals)
{
refs += " *"+vers.Key + "* " + string.Join(",", vers.Value.Select(it => it.NameCSproj()).ToArray());
@* @Html.Raw(vers.Key) @Html.Raw("&nbsp;") @Html.Raw(string.Join(",",vers.Value.Select(it=>it.NameCSproj()))) *@
@* @(vers.Key) @("&nbsp;") @(string.Join(",",vers.Value.Select(it=>it.NameCSproj()))) *@

}

<text>| @Html.Raw(i) | @Html.Raw(item.Key) @Html.Raw(textReferences) | @Html.Raw(diffMajor) @refs|
<text>| @(i) | @(item.Key) @(textReferences) | @(diffMajor) @refs|
</text>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sidebar_position: 70
---

# Different major version packages
# Packages with major version different

## Packages major version differ : @keysPackageMultiple.Length

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var rootProjects = Model.RootProjects;
var nrPackages = Model.MaxPackages+1;
var nrRelations = Model.MaxReferences+1;
var nrUpstream = Model.MaxUpStreamReferences+1;
var prefix = GlobalsForGenerating.globalPrefix();

}
Expand All @@ -11,9 +12,41 @@ sidebar_position: 10
---


# Solution relations (without tests)
# Solution relations

## Quadrant Packages / Relations
## Number projects (without tests): @Model.MaxReferences

## Quadrant relations in / out

```mermaid

quadrantChart
title Number of Relations of each project
x-axis Low number Upstream --> High number Upstream
y-axis Small number Relations --> High number Relations
@* quadrant-1 Difficult
quadrant-2 Business experience
quadrant-3 Easy
quadrant-4 Nuget experience
*@
@foreach (var proj in Model.AlphabeticOrderedProjectsNoTests)
{
if (proj.IsTestProject()) continue;
var nameCsproj = proj.NameCSproj();
var relativePath = proj.RelativePath();
var nrUpstreamProj = Decimal.Divide(proj.UpStreamProjectReferences.Count, nrUpstream);
var nrRelationsProj = Decimal.Divide(proj.ProjectsReferences.Count, nrRelations);
if (((int)nrUpstreamProj) == nrUpstreamProj) nrUpstreamProj = nrUpstreamProj + 0.01M;
if (((int)nrRelationsProj) == nrRelationsProj) nrRelationsProj = nrRelationsProj + 0.01M;
string data = $"{nameCsproj}: [{nrUpstreamProj.ToString("F2")},{nrRelationsProj.ToString("F2")}]";
<text>
@data
</text>
}

```

## Quadrant packages / relations

```mermaid

Expand Down

0 comments on commit d8a5f50

Please sign in to comment.