Skip to content

Commit 95839c9

Browse files
azure-sdksima-zhu
andauthored
Fix the duplicates and revert the unique checking (#23595)
Co-authored-by: sima-zhu <[email protected]>
1 parent a6a4145 commit 95839c9

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

eng/common/scripts/Update-DocsMsToc.ps1

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,6 @@ function GetPackageLookup($packageList) {
9090
Write-Host "Found more than one package entry for $($pkg.Package) selecting the first non-hidden one."
9191
}
9292
}
93-
94-
if ($pkg.PSObject.Members.Name -contains "GroupId" -and ($pkg.New -eq "true") -and $pkg.Package) {
95-
$pkgKey = $pkg.Package
96-
if (!$packageLookup.ContainsKey($pkgKey)) {
97-
$packageLookup[$pkgKey] = $pkg
98-
}
99-
else {
100-
$packageValue = $packageLookup[$pkgKey]
101-
Write-Host "Found more than one package entry for $($packageValue.Package) selecting the first one with groupId $($packageValue.GroupId), skipping $($pkg.GroupId)"
102-
}
103-
}
10493
}
10594

10695
return $packageLookup
@@ -116,7 +105,7 @@ $onboardedPackages = &$GetOnboardedDocsMsPackagesFn `
116105
$metadata = (Get-CSVMetadata).Where({
117106
$_.Package `
118107
-and $onboardedPackages.ContainsKey($_.Package) `
119-
-and $_.Hide -ne 'true'
108+
-and $_.Hide -ne 'true'
120109
})
121110

122111
$fileMetadata = @()
@@ -177,7 +166,6 @@ foreach ($package in $packagesForToc.Values) {
177166
}
178167
$serviceNameList = $services.Keys | Sort-Object
179168

180-
181169
$toc = @()
182170
foreach ($service in $serviceNameList) {
183171
Write-Host "Building service: $service"
@@ -186,14 +174,11 @@ foreach ($service in $serviceNameList) {
186174

187175
# Client packages get individual entries
188176
$clientPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and ('client' -eq $_.Type) })
189-
$clientPackages = $clientPackages | Sort-Object 'Package', 'GroupId' | Get-Unique
190-
if ($clientPackages) {
191-
foreach ($clientPackage in $clientPackages) {
192-
$packageItems += GetClientPackageNode -clientPackage $clientPackage
193-
}
177+
$clientPackages = $clientPackages | Sort-Object -Property Package
178+
foreach ($clientPackage in $clientPackages) {
179+
$packageItems += GetClientPackageNode -clientPackage $clientPackage
194180
}
195181

196-
197182
# All management packages go under a single `Management` header in the ToC
198183
$mgmtPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and ('mgmt' -eq $_.Type) })
199184
$mgmtPackages = $mgmtPackages | Sort-Object -Property Package
@@ -207,7 +192,7 @@ foreach ($service in $serviceNameList) {
207192
# There could be multiple packages, ensure this is treated as an array
208193
# even if it is a single package
209194
children = @($children)
210-
};
195+
}
211196
}
212197

213198
$uncategorizedPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and !(@('client', 'mgmt') -contains $_.Type) })
@@ -218,13 +203,13 @@ foreach ($service in $serviceNameList) {
218203
}
219204

220205
$serviceReadmeBaseName = $service.ToLower().Replace(' ', '-')
206+
221207
$serviceTocEntry = [PSCustomObject]@{
222208
name = $service;
223209
href = "~/docs-ref-services/{moniker}/$serviceReadmeBaseName.md"
224210
landingPageType = 'Service'
225211
items = @($packageItems)
226212
}
227-
228213
$toc += $serviceTocEntry
229214
}
230215

@@ -286,7 +271,6 @@ if ($otherPackages) {
286271
}
287272
}
288273
}
289-
290274
$toc += [PSCustomObject]@{
291275
name = 'Other';
292276
landingPageType = 'Service';

0 commit comments

Comments
 (0)