|
| 1 | +# ------------------------------------------------------------------------------ |
| 2 | +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. |
| 3 | +# ------------------------------------------------------------------------------ |
| 4 | + |
| 5 | +function Create-ModuleMappingFile { |
| 6 | + [cmdletbinding()] |
| 7 | + param( |
| 8 | + [string] |
| 9 | + $ModuleName = 'Entra' # Default to "Entra" if no argument is provided |
| 10 | + ) |
| 11 | + |
| 12 | + PROCESS { |
| 13 | + |
| 14 | + if($ModuleName -eq 'Entra'){ |
| 15 | + $rootModuleName = 'Microsoft.Entra' |
| 16 | + $docFolderName = 'entra-powershell-v1.0' |
| 17 | + } |
| 18 | + elseif($ModuleName -eq 'EntraBeta'){ |
| 19 | + $rootModuleName = 'Microsoft.Entra.Beta' |
| 20 | + $docFolderName = 'entra-powershell-beta' |
| 21 | + } |
| 22 | + |
| 23 | + $moduleFolderPath = (Join-Path $PSScriptRoot "../module/docs/$docFolderName") |
| 24 | + Write-Host "[ModuleFolderPath] $moduleFolderPath" -ForegroundColor 'Green' |
| 25 | + $subModules = @(Get-ChildItem -Path $moduleFolderPath -Directory) |
| 26 | + Write-Host "[subModules] $($subModules.Count)" -ForegroundColor 'Green' |
| 27 | + |
| 28 | + $mapping = @{} |
| 29 | + |
| 30 | + foreach($subModuleName in $subModules.Name){ |
| 31 | + $subModuleFolderPath = (Join-Path $moduleFolderPath $subModuleName) |
| 32 | + Write-Host "[ModuleFolderPath] $subModuleFolderPath" -ForegroundColor 'Green' |
| 33 | + $subModulesDocs = @(Get-ChildItem -Path $subModuleFolderPath -File) |
| 34 | + |
| 35 | + foreach($subModuleDoc in $subModulesDocs){ |
| 36 | + if($subModuleDoc.BaseName -ne 'Enable-EntraAzureADAlias'){ |
| 37 | + $mapping.Add($subModuleDoc.BaseName,$subModuleName) |
| 38 | + } |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + # Save the mapping to a JSON file |
| 43 | + $mappingFilePath = (Join-Path $PSScriptRoot "$ModuleName-ModuleMapping.json") |
| 44 | + $mapping | ConvertTo-Json -Depth 10 | Out-File -FilePath $mappingFilePath -Encoding utf8 |
| 45 | + } |
| 46 | +} |
0 commit comments