Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
47 lines (41 loc) · 1.87 KB

File metadata and controls

47 lines (41 loc) · 1.87 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function Build-PSModuleBase {
<#
.SYNOPSIS
Compiles the base module files.
.DESCRIPTION
This function will compile the base module files.
It will copy the source files to the output folder and remove the files that are not needed.
.EXAMPLE
Build-PSModuleBase -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule'
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSReviewUnusedParameter', '', Scope = 'Function',
Justification = 'LogGroup - Scoping affects the variables line of sight.'
)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSAvoidUsingWriteHost', '', Scope = 'Function',
Justification = 'Want to just write to the console, not the pipeline.'
)]
param(
# Name of the module.
[Parameter(Mandatory)]
[string] $ModuleName,
# Path to the folder where the module source code is located.
[Parameter(Mandatory)]
[System.IO.DirectoryInfo] $ModuleSourceFolder,
# Path to the folder where the built modules are outputted.
[Parameter(Mandatory)]
[System.IO.DirectoryInfo] $ModuleOutputFolder
)
Set-GitHubLogGroup 'Build base' {
$relModuleSourceFolder = $ModuleSourceFolder | Resolve-Path -Relative
$relModuleOutputFolder = $ModuleOutputFolder | Resolve-Path -Relative
Write-Host "Copying files from [$relModuleSourceFolder] to [$relModuleOutputFolder]"
Copy-Item -Path "$ModuleSourceFolder\*" -Destination $ModuleOutputFolder -Recurse -Force -Exclude "$ModuleName.psm1"
$null = New-Item -Path $ModuleOutputFolder -Name "$ModuleName.psm1" -ItemType File -Force
}
Set-GitHubLogGroup 'Build base - Result' {
Get-ChildItem -Path $ModuleOutputFolder -Recurse -Force | Resolve-Path -Relative | Sort-Object
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.