pf-RemoveRequiredDeclaracion.ps1
function Remove-Modules_Required { Param( [Parameter(ValueFromPipeline=$true)] $path ) process { $path = $path.FullName ?? $path $ScriptName = 'ConvertTo-Expression' Import-Script_AsModule -ScriptName $ScriptName -RequiredVersion 3.3.0 -WhenNotDefined $ScriptName $str = Get-Content -Raw -Path $path $data = $str | ConvertFrom-Pson -ForceOrderedHashTables $data.Remove("RequiredModules") $data.PrivateData.PSData.Remove("ExternalModuleDependencies") $result = $data | ConvertTo-Pson $result = $result.Replace('[ordered]@{','@{') $altPath = $path $pretty | Set-Content -Force -NoNewline -Path $altPath # Testing Import-PowerShellDataFile -Path $altPath -ErrorAction SilentlyContinue | Out-Null } } function Remove-Modules_Required:::Example { Get-ChildItem -file -Recurse -Filter *.psd1 | Remove-Modules_Required } |