Skip to content

Commit 71fc45f

Browse files
committed
Update to Build-Module
1 parent 5068362 commit 71fc45f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Source/Public/Build-Module.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,14 @@ function Build-Module {
210210
# We have to force the Encoding to string because PowerShell Core made up encodings
211211
SetModuleContent -Source (@($ModuleInfo.Prefix) + $AllScripts.FullName + @($ModuleInfo.Suffix)).Where{$_} -Output $RootModule -Encoding "$($ModuleInfo.Encoding)"
212212

213+
if (-not $ModuleInfo.IgnoreAlias) {
214+
$AliasesToExport = $ParseResult | GetCommandAlias
215+
}
216+
213217
# If there is a PublicFilter, update ExportedFunctions
214218
if ($ModuleInfo.PublicFilter) {
215219
# SilentlyContinue because there don't *HAVE* to be public functions
216-
if (($PublicFunctions = Get-ChildItem $ModuleInfo.PublicFilter -Recurse -ErrorAction SilentlyContinue | Where-Object BaseName -in $AllScripts.BaseName | Select-Object -ExpandProperty BaseName)) {
220+
if (($PublicFunctions = Get-ChildItem $ModuleInfo.PublicFilter -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.BaseName -in $AllScripts.BaseName -and $_.BaseName -notin $AliasesToExport } | Select-Object -ExpandProperty BaseName)) {
217221
Update-Metadata -Path $OutputManifest -PropertyName FunctionsToExport -Value $PublicFunctions
218222
}
219223
}
@@ -222,7 +226,7 @@ function Build-Module {
222226
$ParseResult | MoveUsingStatements -Encoding "$($ModuleInfo.Encoding)"
223227

224228
if ($PublicFunctions -and -not $ModuleInfo.IgnoreAlias) {
225-
if (($AliasesToExport = ($ParseResult | GetCommandAlias)[$PublicFunctions] | ForEach-Object { $_ } | Select-Object -Unique)) {
229+
if (($AliasesToExport = $AliasesToExport[$PublicFunctions] | ForEach-Object { $_ } | Select-Object -Unique)) {
226230
Update-Metadata -Path $OutputManifest -PropertyName AliasesToExport -Value $AliasesToExport
227231
}
228232
}

0 commit comments

Comments
 (0)