PowerShellProTools.psm1
function Invoke-Package { param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context) $outputPath = Split-Path -Path $context.CurrentFile.Path -Leaf $outputPath = Join-Path -Path $outputPath -ChildPath "Output" Merge-Script -Config @{ Root = $context.CurrentFile.Path OutputPath = $outputPath Package = @{ Enabled = $true Obfuscate = $true } Bundle = @{ Enabled = $true Modules = $true NestedModules = $true RequiredAssemblies = $true } } } function New-VsCodeCommands { Register-EditorCommand -Verbose ` -Name "PowerShellProTools.PackageScriptAsExe" ` -DisplayName "Package script as executable" ` -Function Invoke-Package } if ($host.Name -eq 'Visual Studio Code Host'){ New-VsCodeCommands } |