Skip to content

Commit 0d97dae

Browse files
committed
Improve NuGet package metadata, README and Source Link
Add RepositoryUrl/RepositoryType/PackageProjectUrl, pack the root README via PackageReadmeFile, and reference Microsoft.SourceLink.GitHub for the WLED and WLED.DependencyInjection packages so nuget.org links back to the repo, renders the README, and ships working Source Link. Adds plans/15-nuget-package-metadata.md and updates the roadmap and changelog.
1 parent dc76f01 commit 0d97dae

6 files changed

Lines changed: 121 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ rather than deprecated, so consuming code must be updated.
5353
on modern runtimes, so a long-lived client picks up DNS/IP changes instead of pinning a stale
5454
connection (fixes [#8](https://github.com/kevbite/WLED.NET/issues/8)). The `netstandard2.0`
5555
build falls back to `HttpClientHandler`; use `IHttpClientFactory`/DI there.
56+
- **Richer NuGet package metadata** for `WLED` and `WLED.DependencyInjection`: the package
57+
pages now link back to the GitHub repository (`RepositoryUrl`/`PackageProjectUrl`), render the
58+
README (`PackageReadmeFile`), and ship Source Link (`Microsoft.SourceLink.GitHub`) so
59+
consumers can step through the library source in their debugger.
5660

5761
### Added
5862

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<Product>WLED.NET</Product>
44
<Copyright>Copyright 2020 Kevsoft</Copyright>
55
<Authors>Kevin Smith</Authors>
6+
<RepositoryUrl>https://github.com/kevbite/WLED.NET</RepositoryUrl>
7+
<RepositoryType>git</RepositoryType>
8+
<PackageProjectUrl>https://github.com/kevbite/WLED.NET</PackageProjectUrl>
69
<LangVersion>latest</LangVersion>
710
<LibraryTargetFrameworks>netstandard2.0;net8.0;net9.0;net10.0</LibraryTargetFrameworks>
811
<TestTargetFrameworks>net8.0;net9.0;net10.0</TestTargetFrameworks>

plans/15-nuget-package-metadata.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Plan 15 — NuGet package metadata, README & Source Link
2+
3+
**Theme:** Packaging · Discoverability · Quality
4+
5+
Inspired by [a metadata-completeness issue on Mongo.SignalR.Backplane](https://github.com/gottscj/Mongo.SignalR.Backplane/issues/5):
6+
the same class of gaps applies to the `WLED` and `WLED.DependencyInjection` packages.
7+
8+
## Why
9+
10+
A NuGet package is a product page. When key metadata is missing, consumers lose trust and
11+
tooling loses links:
12+
13+
- no **Source repository** link back to GitHub,
14+
- no **Project website** link,
15+
- no **README** rendered on the package page (NuGet renders `PackageReadmeFile`),
16+
- and — for a great debugging experience — **Source Link** lets consumers step into the
17+
library's source straight from their debugger.
18+
19+
The two packable projects (`src/Kevsoft.WLED`, `src/Kevsoft.WLED.DependencyInjection`)
20+
already set `IncludeSymbols`/`SymbolPackageFormat=snupkg`, `PublishRepositoryUrl`,
21+
`EmbedUntrackedSources` and `PackageLicenseExpression=MIT`, but are missing the repository
22+
URL, project URL, README packaging and the Source Link package — so the symbols/source
23+
experience is incomplete and the package pages have no GitHub/README links.
24+
25+
## Current state (per `.csproj`)
26+
27+
Present: `PackageId`, `Title`, `PackageTags`, `PackageIcon`, `PackageLicenseExpression`,
28+
`Description`, `IsPackable`, `EmbedUntrackedSources`, `IncludeSymbols`,
29+
`SymbolPackageFormat=snupkg`, `PublishRepositoryUrl`. `Authors`/`Copyright`/`Product` come
30+
from `Directory.Build.props`.
31+
32+
Missing:
33+
34+
-`RepositoryUrl` / `RepositoryType` → no "Source repository" link.
35+
-`PackageProjectUrl` → no "Project website" link.
36+
-`PackageReadmeFile` + packed `README.md` → README not rendered on nuget.org.
37+
-`Microsoft.SourceLink.GitHub` → Source Link not wired up, so the published `.snupkg`
38+
can't map back to GitHub source.
39+
40+
## Approach
41+
42+
Shared identity goes in `Directory.Build.props` (applies to every project; harmless on the
43+
non-packable test/sample projects and keeps the two packages consistent):
44+
45+
```xml
46+
<RepositoryUrl>https://github.com/kevbite/WLED.NET</RepositoryUrl>
47+
<RepositoryType>git</RepositoryType>
48+
<PackageProjectUrl>https://github.com/kevbite/WLED.NET</PackageProjectUrl>
49+
```
50+
51+
Per packable project (`Kevsoft.WLED.csproj`, `Kevsoft.WLED.DependencyInjection.csproj`):
52+
53+
```xml
54+
<PackageReadmeFile>README.md</PackageReadmeFile>
55+
...
56+
<ItemGroup>
57+
<None Include="../../README.md" Pack="true" Visible="false" PackagePath="" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
61+
</ItemGroup>
62+
```
63+
64+
Notes / decisions:
65+
66+
- The repo root `README.md` is reused for both packages. It's the project shop window and is
67+
already kept current as part of every plan's Definition of Done.
68+
- `Microsoft.SourceLink.GitHub` is added per packable project (not globally) so the
69+
build-time package isn't pulled into the test/sample restores. `PrivateAssets="All"` keeps
70+
it out of the consumer's dependency graph.
71+
- `8.0.0` is the current stable Source Link package and supports all four target frameworks
72+
(incl. `netstandard2.0`).
73+
- `EmbedUntrackedSources` + `PublishRepositoryUrl` are already set, so once Source Link is
74+
referenced the deterministic source mapping completes with no further config.
75+
76+
## Tests
77+
78+
This is a packaging change with no runtime surface, so there are no new unit tests. Verify by
79+
**packing** instead:
80+
81+
- `dotnet pack src/Kevsoft.WLED/Kevsoft.WLED.csproj -c Release` produces both a `.nupkg` and a
82+
`.snupkg`.
83+
- Inspect the generated `.nuspec` inside the `.nupkg` and confirm `<repository …>`,
84+
`<projectUrl>`, `<readme>README.md</readme>` and a packed `README.md` are present.
85+
- Full `dotnet build`/`dotnet test` (all four TFMs) remain green.
86+
87+
## Definition of Done (per `plans/README.md`)
88+
89+
1. **README.md** — no consumer-facing API change; the README itself now ships in the package.
90+
No snippet change required.
91+
2. **samples/BasicConsole** — unaffected.
92+
3. **CHANGELOG.md** — record the packaging improvements under the unreleased section.
93+
94+
## Out of scope
95+
96+
- Changing the package icon, license file form (`PackageLicenseExpression=MIT` stays), or
97+
versioning scheme.
98+
- Publishing/CI changes — the existing pipeline already pushes `.nupkg`/`.snupkg`.

plans/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ These plans cross-reference two mature community libraries (linked by the WLED d
6464
| 9 | [Effect metadata (`/json/fxdata`)](9-effect-metadata.md) | Feature |
6565
| 10 | [Configuration API (`/json/cfg`)](10-config-api.md) | Feature |
6666
| 11 | [Client ergonomics & cross-cutting concerns](11-client-ergonomics-and-cross-cutting.md) | Quality |
67+
| 12 | [Usability & correctness improvements](12-usability-and-correctness-improvements.md) | Quality |
68+
| 13 | [Device ergonomics & agent guidance](13-device-ergonomics-and-agent-guidance.md) | Quality |
69+
| 14 | [HttpClient connection lifetime & DNS staleness](14-httpclient-connection-lifetime.md) | Reliability |
70+
| 15 | [NuGet package metadata, README & Source Link](15-nuget-package-metadata.md) | Packaging |
6771
| 12 | [Usability & correctness improvements (post-review)](12-usability-and-correctness-improvements.md) | Correctness |
6872
| 13 | [Device ergonomics, catalogs & agent guidance](13-device-ergonomics-and-agent-guidance.md) | Usability |
6973
| 14 | [HttpClient connection lifetime & DNS staleness](14-httpclient-connection-lifetime.md) | Correctness |

src/Kevsoft.WLED.DependencyInjection/Kevsoft.WLED.DependencyInjection.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<Title>WLED.NET Dependency Injection</Title>
1111
<PackageTags>WLED;DependencyInjection;IHttpClientFactory</PackageTags>
1212
<PackageIcon>icon.png</PackageIcon>
13+
<PackageReadmeFile>README.md</PackageReadmeFile>
1314
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1415
<Description>Microsoft.Extensions.DependencyInjection integration for WLED.NET.</Description>
1516
<IsPackable>True</IsPackable>
@@ -21,6 +22,11 @@
2122

2223
<ItemGroup>
2324
<None Include="../../icon.png" Pack="true" Visible="false" PackagePath="" />
25+
<None Include="../../README.md" Pack="true" Visible="false" PackagePath="" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
2430
</ItemGroup>
2531

2632
<ItemGroup>

src/Kevsoft.WLED/Kevsoft.WLED.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<Title>WLED.NET</Title>
1010
<PackageTags>WLED</PackageTags>
1111
<PackageIcon>icon.png</PackageIcon>
12+
<PackageReadmeFile>README.md</PackageReadmeFile>
1213
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1314
<Description>A .NET Wrapper around the WLED JSON API.</Description>
1415
<IsPackable>True</IsPackable>
@@ -20,12 +21,17 @@
2021

2122
<ItemGroup>
2223
<None Include="../../icon.png" Pack="true" Visible="false" PackagePath="" />
24+
<None Include="../../README.md" Pack="true" Visible="false" PackagePath="" />
2325
</ItemGroup>
2426

2527
<ItemGroup>
2628
<InternalsVisibleTo Include="Kevsoft.WLED.Tests" />
2729
</ItemGroup>
2830

31+
<ItemGroup>
32+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
33+
</ItemGroup>
34+
2935
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
3036
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
3137
<PackageReference Include="System.Text.Json" Version="8.0.5" />

0 commit comments

Comments
 (0)