From 67d48e2c3e5b747215828ff2881cea2396e4e9fa Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 5 Nov 2023 16:20:18 -0800 Subject: [PATCH] enhancement: Updating PipeScript.ezout Generating multiple partitioned files (Fixes #544). Allowing formatting definitions within Types (Fixes #559) --- Build/PipeScript.ezout.ps1 | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Build/PipeScript.ezout.ps1 b/Build/PipeScript.ezout.ps1 index d80c79e63..4d8984c50 100644 --- a/Build/PipeScript.ezout.ps1 +++ b/Build/PipeScript.ezout.ps1 @@ -1,5 +1,7 @@ #requires -Module EZOut # Install-Module EZOut or https://github.com/StartAutomating/EZOut +param() + $myFile = $MyInvocation.MyCommand.ScriptBlock.File $myModuleName = 'PipeScript' $myRoot = $myFile | Split-Path | Split-Path @@ -7,7 +9,7 @@ Push-Location $myRoot $formatting = @( # Add your own Write-FormatView here, # or put them in a Formatting or Views directory - foreach ($potentialDirectory in 'Formatting','Views') { + foreach ($potentialDirectory in 'Formatting','Views','Types') { Join-Path $myRoot $potentialDirectory | Get-ChildItem -ea ignore | Import-FormatView -FilePath {$_.Fullname} @@ -18,8 +20,12 @@ $destinationRoot = $myRoot if ($formatting) { $myFormatFile = Join-Path $destinationRoot "$myModuleName.format.ps1xml" - $formatting | Out-FormatData -Module $MyModuleName | Set-Content $myFormatFile -Encoding UTF8 - Get-Item $myFormatFile + + $formatting | Out-FormatData -Module $MyModuleName -OutputPath $MyFormatFile + $formatting | Out-FormatData -Module $MyModuleName -OutputPath ([Ordered]@{ + "System.Management.Automation.*" = "$(Join-Path $destinationRoot "PipeScript.Extends.PowerShell.format.ps1xml")" + "Microsoft.CodeAnalysis.*" = "$(Join-Path $destinationRoot "PipeScript.Extends.CodeAnalysis.format.ps1xml")" + }) } $types = @( @@ -33,7 +39,11 @@ $types = @( if ($types) { $myTypesFile = Join-Path $destinationRoot "$myModuleName.types.ps1xml" - $types | Out-TypeData | Set-Content $myTypesFile -Encoding UTF8 - Get-Item $myTypesFile + + $types | Out-TypeData -OutputPath $myTypesFile + $types | Out-TypeData -OutputPath ([Ordered]@{ + "System.Management.Automation.*" = "$(Join-Path $destinationRoot "PipeScript.Extends.PowerShell.types.ps1xml")" + "Microsoft.CodeAnalysis.*" = "$(Join-Path $destinationRoot "PipeScript.Extends.CodeAnalysis.types.ps1xml")" + })#> } Pop-Location