Skip to content

Compress MgCommandMetadata.json to reduce whitespace/package size #3346

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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
28 changes: 14 additions & 14 deletions tools/PostGeneration/AuthModuleMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if ($null -eq $ConnectCommand) {
Uri = $null
}
# Update the file
$FinalConnectMgGraphOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalConnectMgGraphOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalConnectMgGraphOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Connect-MgGraph command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -43,7 +43,7 @@ if ($null -eq $AddEnvironmentCommand) {
Uri = $null
}
# Update the file
$FinalAddEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalAddEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalAddEnvironmentOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Add-MgEnvironment command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -65,7 +65,7 @@ if ($null -eq $GetEnvironmentCommand) {
Uri = $null
}
# Update the file
$FinalGetEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalGetEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalGetEnvironmentOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Get-MgEnvironment command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -87,7 +87,7 @@ if ($null -eq $RemoveEnvironmentCommand) {
Uri = $null
}
# Update the file
$FinalRemoveEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalRemoveEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalRemoveEnvironmentOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Remove-MgEnvironment command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -109,7 +109,7 @@ if ($null -eq $SetEnvironmentCommand) {
Uri = $null
}
# Update the file
$FinalSetEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalSetEnvironmentOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalSetEnvironmentOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Set-MgEnvironment command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -131,7 +131,7 @@ if ($null -eq $DisconnectCommand) {
Uri = $null
}
# Update the file
$FinalDisconnectOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalDisconnectOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalDisconnectOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Disconnect-MgGraph command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -153,7 +153,7 @@ if ($null -eq $FindCommand) {
Uri = $null
}
# Update the file
$FinalFindOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalFindOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalFindOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Find-MgGraphCommand command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -175,7 +175,7 @@ if ($null -eq $FindPermissionCommand) {
Uri = $null
}
# Update the file
$FinalFindPermissionOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalFindPermissionOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalFindPermissionOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Find-MgGraphPermission command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -197,7 +197,7 @@ if ($null -eq $GetContextCommand) {
Uri = $null
}
# Update the file
$FinalGetContextOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalGetContextOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalGetContextOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Get-MgContext command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -219,7 +219,7 @@ if ($null -eq $GetGraphOptionCommand) {
Uri = $null
}
# Update the file
$FinalGetGraphOptionOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalGetGraphOptionOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalGetGraphOptionOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Get-MgGraphOption command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -241,7 +241,7 @@ if ($null -eq $GetRequestContextCommand) {
Uri = $null
}
# Update the file
$FinalGetRequestContextOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalGetRequestContextOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalGetRequestContextOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Get-MgRequestContext command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -263,7 +263,7 @@ if ($null -eq $InvokeRequestCommand) {
Uri = $null
}
# Update the file
$FinalInvokeRequestOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalInvokeRequestOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalInvokeRequestOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Invoke-MgGraphRequest command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -285,7 +285,7 @@ if ($null -eq $SetGraphOptionCommand) {
Uri = $null
}
# Update the file
$FinalSetGraphOptionOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalSetGraphOptionOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalSetGraphOptionOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Set-MgGraphOption command added to the list of commands in MgCommandMetadata.json"
Expand All @@ -307,7 +307,7 @@ if ($null -eq $SetRequestContextCommand) {
Uri = $null
}
# Update the file
$FinalSetRequestContextOutPut = $CommandMetadata | ConvertTo-Json -Depth 10
$FinalSetRequestContextOutPut = $CommandMetadata | ConvertTo-Json -Depth 10 -Compress

$FinalSetRequestContextOutPut | Set-Content -Path $CommandMetadataFile -Force
Write-Host "Set-MgRequestContext command added to the list of commands in MgCommandMetadata.json"
Expand Down
2 changes: 1 addition & 1 deletion tools/PostGeneration/NewCommandMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ if ($CommandPathMapping.Count -eq 0) {
}
else {
Write-Debug "Writing metadata to $MgCommandMetadataFile."
$CommandPathMapping.GetEnumerator() | Sort-Object Name | Select-Object -ExpandProperty Value | ConvertTo-Json -Depth 4 | Out-File -FilePath $MgCommandMetadataFile
$CommandPathMapping.GetEnumerator() | Sort-Object Name | Select-Object -ExpandProperty Value | ConvertTo-Json -Depth 4 -Compress | Out-File -FilePath $MgCommandMetadataFile
}
$stopwatch.Stop()
Write-Debug "Generated command metadata file in '$($Stopwatch.Elapsed.TotalSeconds)`s."