Skip to content

Commit

Permalink
Add command to fetch and discover nuget oss stats
Browse files Browse the repository at this point in the history
This command performs the following tasks:
- Search all packages, sorted by most downloaded
- Lookup each and determine if it has source repo information
- If the source repo is github, lookup contributors

This builds a map of:
- GH users > repos > nugets

This will allow sponsorlink to consider "oss authors" all GH users who have contributed to repos that produce nuget packages that are active and popular.
  • Loading branch information
kzu committed Sep 25, 2024
1 parent 3ec1b11 commit 4638da9
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 2 deletions.
1 change: 0 additions & 1 deletion samples/dotnet/Analyzer/GraceApiAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Immutable;
using System.Linq;
using Devlooped.Sponsors;
using Humanizer;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
Expand Down
3 changes: 3 additions & 0 deletions src/Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#endif

var app = App.Create(out var services);
#if DEBUG
app.Configure(c => c.PropagateExceptions());
#endif

if (args.Contains("-?"))
args = args.Select(x => x == "-?" ? "-h" : x).ToArray();
Expand Down
5 changes: 5 additions & 0 deletions src/Commands/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public static CommandApp Create(out IServiceProvider services)
config.AddCommand<SyncCommand>();
config.AddCommand<ViewCommand>();
config.AddCommand<WelcomeCommand>().IsHidden();
config.AddCommand<NuGetStatsCommand>("nuget")
#if !DEBUG
.IsHidden()
#endif
;
});

services = registrar.Services.BuildServiceProvider();
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CliGraphQueryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class CliGraphQueryClient : IGraphQueryClient
// Legacy queries won't have anything in the "query" (a URL endpoint is expected), but can still paginate in the CLI.
// NOTE: this is an inconsistency with the HttpGraphQueryClient, which doesn't do pagination for legacy queries.
// TODO: perhaps we should implement that, but it's not needed right now.
(query.IsLegacy ||
(query.IsLegacy ||
(query.Query.Contains("$endCursor") && query.Query.Contains("first:")));

if (paginate)
Expand Down
3 changes: 3 additions & 0 deletions src/Commands/Commands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Devlooped.Web" Version="1.2.2" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="NuGet.Protocol" Version="6.11.0" />
<PackageReference Include="NuGetizer" Version="1.2.3" PrivateAssets="all" />
<PackageReference Include="Polly" Version="8.4.1" />
<PackageReference Include="Spectre.Console.Cli" Version="0.49.1" />
<PackageReference Include="Spectre.Console.Json" Version="0.49.1" />
<PackageReference Include="Devlooped.CredentialManager" Version="2.5.0.1" />
Expand Down
Loading

0 comments on commit 4638da9

Please sign in to comment.