@@ -11,18 +11,20 @@ param(
1111$packageId = " terminal.gui" # Ensure this is the correct package name (case-sensitive)
1212$nugetSource = " https://api.nuget.org/v3/index.json"
1313
14- # Fetch package versions from NuGet API
15- $nugetApiUrl = " https://api.nuget.org/v3-flatcontainer/ $packageId /index.json "
16- Write-Host " Fetching package versions for '$packageId '..."
14+ # Fetch ONLY listed package versions from NuGet Autocomplete API
15+ $nugetApiUrl = " https://api-v2v3search-0 .nuget.org/autocomplete?id= $packageId &prerelease=true&semVerLevel=2.0.0 "
16+ Write-Host " Fetching listed package versions for '$packageId '..."
1717
1818try {
1919 $versionsResponse = Invoke-RestMethod - Uri $nugetApiUrl
20- $allVersions = $versionsResponse.versions
20+ $allVersions = $versionsResponse.data
2121} catch {
2222 Write-Host " Error fetching package versions: $_ "
2323 exit 0
2424}
2525
26+ Write-Host " Found $ ( $allVersions.Count ) listed versions."
27+
2628# Function to parse version and extract numeric parts for comparison
2729function Get-VersionSortKey {
2830 param ([string ]$version )
@@ -87,13 +89,13 @@ function Process-PackageVersions {
8789 }
8890}
8991
90- # # Process develop packages - keep only the most recent
91- # Process-PackageVersions -Pattern "^2\.0\.0-develop\..*$" -PackageType "develop" -AllVersions $allVersions
92+ # Process develop packages - keep only the most recent
93+ Process - PackageVersions - Pattern " ^2\.0\.0-develop\..*$" - PackageType " develop" - AllVersions $allVersions
9294
93- # # Process alpha packages - keep only the just-published one or most recent
94- # Process-PackageVersions -Pattern "^2\.0\.0-alpha\..*$" -PackageType "alpha" -AllVersions $allVersions -JustPublished $JustPublishedVersion
95+ # Process alpha packages - keep only the just-published one or most recent
96+ Process - PackageVersions - Pattern " ^2\.0\.0-alpha\..*$" - PackageType " alpha" - AllVersions $allVersions - JustPublished $JustPublishedVersion
9597
96- # # Process beta packages - keep only the just-published one or most recent (for future use)
97- # Process-PackageVersions -Pattern "^2\.0\.0-beta\..*$" -PackageType "beta" -AllVersions $allVersions -JustPublished $JustPublishedVersion
98+ # Process beta packages - keep only the just-published one or most recent (for future use)
99+ Process - PackageVersions - Pattern " ^2\.0\.0-beta\..*$" - PackageType " beta" - AllVersions $allVersions - JustPublished $JustPublishedVersion
98100
99101Write-Host " Operation complete."
0 commit comments