-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add ToC Generation script and wire up to docindex.yml #19915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
300175e
Add ToC Generation script and wire up to docindex.yml for testing
danieljurek 3ab6bb5
Revert unnecessary changes to eng/common
danieljurek 231b077
Review feedback
danieljurek 86cf2f7
Remove automatic ToC generation from main
danieljurek 9094ad7
Set-StrictMode
danieljurek 247bc0d
Remove Release-DocsMsDocs.ps1
danieljurek f50862f
Use original syntax
danieljurek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,6 +127,7 @@ Thumbs.db | |
|
|
||
| # docs # | ||
| docs/ | ||
| !eng/scripts/docs | ||
| main.conf.json | ||
| child.conf.json | ||
|
|
||
|
|
||
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
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
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
| 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/')) { | ||
| $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 | ||
| } | ||
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.
There was a problem hiding this comment.
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.