-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMerge-Module.ps1
More file actions
33 lines (30 loc) · 1.23 KB
/
Copy pathMerge-Module.ps1
File metadata and controls
33 lines (30 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#requires -Module Configuration
[CmdletBinding()]
param(
$OutputModulePath,
$NestedModulePath
)
$OutputModule = Get-Module $OutputModulePath -ListAvailable
$NestedModule = Get-Module $NestedModulePath -ListAvailable
# Copy and then remove the extra output
Copy-Item -Path (Join-Path $NestedModule.ModuleBase Metadata.psm1) -Destination $OutputModule.ModuleBase
Remove-Item $NestedModule.ModuleBase -Recurse
# Because this is a double-module, combine the exports of both modules
# Put the ExportedFunctions of both in the manifest
Update-Metadata -Path $OutputModule.Path -PropertyName FunctionsToExport `
-Value @(
@(
$NestedModule.ExportedFunctions.Keys
$OutputModule.ExportedFunctions.Keys
) | Select-Object -Unique
# @('*')
)
# Put the ExportedAliases of both in the manifest
Update-Metadata -Path $OutputModule.Path -PropertyName AliasesToExport `
-Value @(
@(
$NestedModule.ExportedAliases.Keys
$OutputModule.ExportedAliases.Keys
) | Select-Object -Unique
# @('*')
)