Repository navigation
Add --min-age option and bump to .NET 10 - #21
Merged
Merged
Conversation
Adds a --min-age (-ma) option that holds back package versions published too recently. The value is a number with an optional suffix, 2d for days and 12h for hours, defaulting to days when no suffix is given. Project files can specify the same thing through the PackagesMinimumAge property, which applies when --min-age is not passed on the command line. When a minimum age is in effect we resolve versions through PackageMetadataResource so that we get the publish date for every version. Without it we stay on the cheaper FindPackageByIdResource path, since the metadata resource pulls full registration pages. Versions from feeds that do not report a publish date are never held back. Also bumps all projects to net10.0 and CI to the .NET 10 SDK. Closes #20 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #20
--min-age/-maHolds back package versions that were published too recently.
Parsing lives in the new
MinimumAgehelper. An invalid value prints an error and exits with1.PackagesMinimumAgeProject files can specify the same thing, used when
--min-ageis not passed at runtime.Resolution is per project file:
--min-agewins, otherwise that file's own property. That avoids having to invent a rule for repos where different projects declare different values.Since we don't evaluate MSBuild, the property only applies in the file that declares it — a value in
Directory.Build.propswon't reach sibling csproj files, thoughDirectory.Packages.propsworks fine under CPM since the references live there too. Noted in the README.How versions get held back
LatestVersionProvidergrew a second path:FindPackageByIdResource.GetAllVersionsAsync, one latest version per feed.PackageMetadataResource.GetMetadataAsync, which returns every version with its publish date.Keeping the cheap path matters: the metadata resource pulls full registration pages, so it is meaningfully slower on large packages.
Both paths feed the new
PackageVersionstype, whoseGetLatestVersion(minimumAge, utcNow)picks the newest version published on or before the cutoff. Versions from feeds that don't report a publish date are never held back.Output
A package with no version old enough now reports
- no version is older than 2 days ⏳rather than the misleading "Unable to find package"..NET 10
All three projects target
net10.0, aglobal.jsonpins the 10.0 SDK, and CI moves todotnet-version: 10.0.xwithsetup-dotnet@v4/checkout@v4. Versions bumped to 3.2.0 and 2.2.0.Two calls worth a second look
Dotnet.Deps.Corewentnetstandard2.0→net10.0. That's what "bump everything" implies, but it's a published library, so consumers on .NET Framework or older .NET lose it. Easy to revert — the code uses no net10-only APIs.IProjectFile<T>gained a member, which breaks external implementers. Hence the Core bump to 2.2.0, though arguably it should be 3.0.0.The
NuGet.*references stay at 6.12.1. They're flagged by NU1901 and 7.9.0 is out, but a 6→7 jump is its own change.Testing
46 tests pass, 9 new: minimum age parsing and formatting as unit tests, plus end-to-end coverage for the option, the short form, the project file property, precedence between the two, and both invalid-value paths.
🤖 Generated with Claude Code