Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Thumbs.db

# docs #
docs/
!eng/scripts/docs
main.conf.json
child.conf.json

Expand Down
11 changes: 11 additions & 0 deletions eng/pipelines/docindex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
Paths:
- ci-configs/packages-latest.json
- ci-configs/packages-preview.json
- ci-configs/packages-legacy.json
- metadata/
- docs-ref-mapping/
Repositories:
- Name: $(DocRepoOwner)/$(DocRepoName)
WorkingDirectory: $(DocRepoLocation)
Expand Down Expand Up @@ -72,6 +74,15 @@ jobs:
arguments: -DocRepoLocation $(DocRepoLocation)
displayName: Update Docs Onboarding for Daily branch

- task: Powershell@2
inputs:
pwsh: true
filePath: eng/common/scripts/Update-DocsMsToc.ps1
arguments: >-
-DocRepoLocation $(DocRepoLocation)
-OutputLocation $(DocRepoLocation)/docs-ref-mapping/reference-unified.yml
displayName: Generate ToC

- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
parameters:
BaseRepoBranch: $(DailyDocsBranchName)
Expand Down
2 changes: 2 additions & 0 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ $packagePattern = "*.tgz"
$MetadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/main/_data/releases/latest/js-packages.csv"
$BlobStorageUrl = "https://azuresdkdocs.blob.core.windows.net/%24web?restype=container&comp=list&prefix=javascript%2F&delimiter=%2F"

. "$PSScriptRoot/docs/Docs-ToC.ps1"

function Confirm-NodeInstallation
{
if (!(Get-Command npm -ErrorAction SilentlyContinue))
Expand Down
89 changes: 89 additions & 0 deletions eng/scripts/docs/Docs-ToC.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
function Get-javascript-OnboardedDocsMsPackages($DocRepoLocation) {
$packageOnboardingFiles = @(
"$DocRepoLocation/ci-configs/packages-latest.json",
"$DocRepoLocation/ci-configs/packages-preview.json",
"$DocRepoLocation/ci-configs/packages-legacy.json")

$onboardedPackages = @{}
foreach ($file in $packageOnboardingFiles) {
$onboardingSpec = ConvertFrom-Json (Get-Content $file -Raw)
foreach ($spec in $onboardingSpec.npm_package_sources) {
$packageName = $spec.name
if ($packageName.LastIndexOf('@') -gt 0) {
# Package has an '@' symbol deliminting the end of the package name
$packageName = $packageName.Substring(0, $packageName.LastIndexOf('@'))
}
$onboardedPackages[$packageName] = $null
}
}

return $onboardedPackages
}

function Get-javascript-DocsMsTocData($packageMetadata, $docRepoLocation) {
# Fallback to get package-level readme name if metadata file info does not exist
$packageLevelReadmeName = $packageMetadata.Package.Replace('@azure/', '').Replace('@azure-tools/', '').Replace('azure-', '');

# Fallback to get package-level readme name if metadata file info does not exist
if ($packageMetadata.Package.StartsWith('@azure-rest/')) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unfortunate that we another place to special case azure-rest. @praveenkuttappan something to look at with your other clean-up of that processing.

$packageLevelReadmeName = "$($packageMetadata.Package.Replace('@azure-rest/', ''))-rest"
}

# If there is a metadata json for the package use the DocsMsReadmeName from
# the metadata function
if ($packageMetadata.PSObject.Members.Name -contains "FileMetadata") {
$readmeMetadata = &$GetDocsMsMetadataForPackageFn -PackageInfo $packageMetadata.FileMetadata
$packageLevelReadmeName = $readmeMetadata.DocsMsReadMeName
}


$packageTocHeader = $packageMetadata.Package
if ($clientPackage.DisplayName) {
$packageTocHeader = $clientPackage.DisplayName
}
$output = [PSCustomObject]@{
PackageLevelReadmeHref = "~/docs-ref-services/{moniker}/$packageLevelReadmeName-readme.md"
PackageTocHeader = $packageTocHeader
TocChildren = @($clientPackage.Package)
}

return $output
}

function Get-javascript-DocsMsTocChildrenForManagementPackages($packageMetadata, $docRepoLocation) {
return @($packageMetadata.Package)
}

function Get-javascript-UpdatedDocsMsToc($toc) {
$services = $toc[0].items
for ($i = 0; $i -lt $services.Count; $i++) {

# Add "Plugin" docs to Identity. Packages associated with these entries do
# not build successfully in the docs CI system becaues they export nothing
# that the docs CI system can document. This ensures that the readme pages
# are documented properly even if their packages are not onboarded.
if ($services[$i].name -eq 'Identity') {
$services[$i].items += [PSCustomObject]@{
name = "Plugins";
items = @(
[PSCustomObject]@{
name = "Token Cache Persistence";
href = "~/docs-ref-services/{moniker}/identity-cache-persistence-readme.md";
landingPageType = "Service";
},
[PSCustomObject]@{
name = "VSCode Authentication";
href = "~/docs-ref-services/{moniker}/identity-vscode-readme.md";
landingPageType = "Service";
}
)
}
}
}

# PowerShell outputs a single object if the output is an array with only one
# object. The preceeding comma ensures that the output remains an array for
# appropriate export formatting. Other formatting (e.g. `@($toc)`) does not
# produce useful outputs.
return , $toc
}