Skip to content

Commit 234efed

Browse files
committed
Fix Build-Module
1 parent 1d5be2f commit 234efed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/Public/Build-Module.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,19 @@ function Build-Module {
214214
$ParseResult | MoveUsingStatements -Encoding "$($ModuleInfo.Encoding)"
215215

216216
if (-not $ModuleInfo.IgnoreAlias) {
217-
$AliasesToExport = $ParseResult | GetCommandAlias
217+
$AliasesToExport = ($ParseResult | GetCommandAlias).Values.Where({$null -ne $_})
218218
}
219219

220220
# If there is a PublicFilter, update ExportedFunctions
221221
if ($ModuleInfo.PublicFilter) {
222222
# SilentlyContinue because there don't *HAVE* to be public functions
223-
if (($PublicFunctions = Get-ChildItem $ModuleInfo.PublicFilter -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.BaseName -in $AllScripts.BaseName -and $_.BaseName -notin $AliasesToExport } | Select-Object -ExpandProperty BaseName)) {
224-
Update-Metadata -Path $OutputManifest -PropertyName FunctionsToExport -Value $PublicFunctions
223+
if (($PublicFunctions = Get-ChildItem $ModuleInfo.PublicFilter -Recurse -ErrorAction SilentlyContinue | Where-Object BaseName -in $AllScripts.BaseName | Select-Object -ExpandProperty BaseName)) {
224+
Update-Metadata -Path $OutputManifest -PropertyName FunctionsToExport -Value ($PublicFunctions | Where-Object {$_ -notin $AliasesToExport})
225225
}
226226
}
227227

228228
if ($PublicFunctions -and -not $ModuleInfo.IgnoreAlias) {
229-
if (($AliasesToExport = $AliasesToExport[$PublicFunctions] | ForEach-Object { $_ } | Select-Object -Unique)) {
229+
if (($AliasesToExport = $AliasesToExport | Where-Object { $_ -in $PublicFunctions } | ForEach-Object { $_ } | Select-Object -Unique)) {
230230
Update-Metadata -Path $OutputManifest -PropertyName AliasesToExport -Value $AliasesToExport
231231
}
232232
}

0 commit comments

Comments
 (0)