Skip to content

Commit 29d8cca

Browse files
State module build help directly
1 parent 64ffb1d commit 29d8cca

13 files changed

Lines changed: 52 additions & 54 deletions

‎.github/actions/Build-PSModule/action.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
name: Build-PSModule
2-
description: Build a PowerShell module to the PowerShell Gallery.
2+
description: Build a PowerShell module for publication to the PowerShell Gallery.
33
author: PSModule
44

55
inputs:
66
Name:
77
description: Name of the module to build. Defaults to the repository name.
88
required: false
99
OutputFolder:
10-
description: Path to the folder where the built module is outputted.
10+
description: Path to the folder for the built module.
1111
required: false
1212
default: '.PSModule/module'
1313
Version:
1414
description: Module version to stamp into the manifest.
1515
required: true
1616
Prerelease:
17-
description: Prerelease tag to stamp into the manifest's `PrivateData.PSData.Prerelease`. When empty, no prerelease tag is written.
17+
description: Prerelease tag for the manifest's `PrivateData.PSData.Prerelease`. An empty value omits the prerelease tag.
1818
required: false
1919
ArtifactName:
2020
description: Name of the artifact to upload.
2121
required: false
2222
default: module
2323
WorkingDirectory:
24-
description: The working directory where the script will run from.
24+
description: Working directory for the script.
2525
required: false
2626
default: '.'
2727

‎.github/actions/Build-PSModule/src/helpers/Build-PSModule.ps1‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function Build-PSModule {
22
<#
33
.SYNOPSIS
4-
Builds a module.
4+
Build a PowerShell module from source files.
55
66
.DESCRIPTION
7-
Builds a module.
7+
Build-PSModule copies the source files, creates the manifest, and combines the scripts into the root module.
88
#>
99
[OutputType([void])]
1010
[CmdletBinding()]
@@ -21,19 +21,19 @@
2121
[Parameter(Mandatory)]
2222
[string] $ModuleName,
2323

24-
# Path to the folder where the modules are located.
24+
# Path to the module source folder.
2525
[Parameter(Mandatory)]
2626
[string] $ModuleSourceFolderPath,
2727

28-
# Path to the folder where the built modules are outputted.
28+
# Path to the folder for the built module.
2929
[Parameter(Mandatory)]
3030
[string] $ModuleOutputFolderPath,
3131

3232
# Module version to stamp into the manifest.
3333
[Parameter(Mandatory)]
3434
[string] $ModuleVersion,
3535

36-
# Prerelease tag to stamp into the manifest. When empty, no prerelease tag is written.
36+
# Prerelease tag for the manifest. An empty value omits the prerelease tag.
3737
[Parameter()]
3838
[string] $ModulePrerelease
3939
)

‎.github/actions/Build-PSModule/src/helpers/Build/Add-ContentFromItem.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function Add-ContentFromItem {
44
Add the content of a folder or file to the root module file.
55
66
.DESCRIPTION
7-
This function will add the content of a folder or file to the root module file.
7+
Add-ContentFromItem adds the content of a folder or file to the root module file.
88
99
.EXAMPLE
1010
Add-ContentFromItem -Path 'C:\MyModule\src\MyModule' -RootModuleFilePath 'C:\MyModule\src\MyModule.psm1' -RootPath 'C:\MyModule\src'

‎.github/actions/Build-PSModule/src/helpers/Build/Build-PSModuleBase.ps1‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
function Build-PSModuleBase {
22
<#
33
.SYNOPSIS
4-
Compiles the base module files.
4+
Build the base module files.
55
66
.DESCRIPTION
7-
This function will compile the base module files.
8-
It will copy the source files to the output folder and remove the files that are not needed.
7+
Build-PSModuleBase copies source files to the output folder.
8+
It creates an empty root module file.
99
1010
.EXAMPLE
1111
Build-PSModuleBase -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule'
@@ -24,11 +24,11 @@
2424
[Parameter(Mandatory)]
2525
[string] $ModuleName,
2626

27-
# Path to the folder where the module source code is located.
27+
# Path to the module source folder.
2828
[Parameter(Mandatory)]
2929
[System.IO.DirectoryInfo] $ModuleSourceFolder,
3030

31-
# Path to the folder where the built modules are outputted.
31+
# Path to the folder for the built module.
3232
[Parameter(Mandatory)]
3333
[System.IO.DirectoryInfo] $ModuleOutputFolder
3434
)

‎.github/actions/Build-PSModule/src/helpers/Build/Build-PSModuleManifest.ps1‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
function Build-PSModuleManifest {
22
<#
33
.SYNOPSIS
4-
Compiles the module manifest.
4+
Build the module manifest.
55
66
.DESCRIPTION
7-
This function will compile the module manifest.
8-
It will generate the module manifest file and copy it to the output folder.
7+
Build-PSModuleManifest creates the module manifest in the output folder.
98
109
.EXAMPLE
1110
Build-PSModuleManifest -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule'
@@ -28,7 +27,7 @@
2827
[Parameter(Mandatory)]
2928
[string] $ModuleName,
3029

31-
# Folder where the built module is outputted. '.PSModule/module/MyModule'
30+
# Folder for the built module files. '.PSModule/module/MyModule'
3231
[Parameter(Mandatory)]
3332
[System.IO.DirectoryInfo] $ModuleOutputFolder,
3433

‎.github/actions/Build-PSModule/src/helpers/Build/Build-PSModuleRootModule.ps1‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
function Build-PSModuleRootModule {
22
<#
33
.SYNOPSIS
4-
Compiles the module root module files.
4+
Build the root module file from source scripts.
55
66
.DESCRIPTION
7-
This function will compile the modules root module from source files.
8-
It will copy the source files to the output folder and start compiling the module.
9-
During compilation, the source files are added to the root module file in the following order:
7+
Build-PSModuleRootModule combines source scripts in the output folder into the root module file.
8+
It adds content in this order:
109
11-
1. Module header from header.ps1 file. Usually to suppress code analysis warnings/errors and to add [CmdletBinding()] to the module.
12-
2. Data loader is added if data files are available.
13-
3. Combines *.ps1 files from the following folders in alphabetical order from each folder:
10+
1. The header.ps1 module header, which can suppress code analysis warnings and errors or add [CmdletBinding()].
11+
2. A data loader, if data files are available.
12+
3. The *.ps1 files from these folders, in alphabetical order within each folder:
1413
1. init
1514
2. classes/private
1615
3. classes/public
1716
4. functions/private
1817
5. functions/public
1918
6. variables/private
2019
7. variables/public
21-
8. Any remaining *.ps1 on module root.
22-
4. Adds a class loader for classes found in the classes/public folder.
23-
5. Export-ModuleMember by using the functions, cmdlets, variables and aliases found in the source files.
24-
- `Functions` will only contain functions that are from the `functions/public` folder.
20+
8. Any remaining *.ps1 files in the module root.
21+
4. A class loader for classes in the classes/public folder.
22+
5. An Export-ModuleMember call with the functions, cmdlets, variables, and aliases from the source files.
23+
- `Functions` contains only functions from the `functions/public` folder.
2524
- `Cmdlets` will only contain cmdlets that are from the `cmdlets/public` folder.
26-
- `Variables` will only contain variables that are from the `variables/public` folder.
27-
- `Aliases` will only contain aliases that are from the functions from the `functions/public` folder.
25+
- `Variables` contains only variables from the `variables/public` folder.
26+
- `Aliases` contains only aliases from functions in the `functions/public` folder.
2827
2928
.EXAMPLE
3029
Build-PSModuleRootModule -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule'
@@ -43,7 +42,7 @@
4342
[Parameter(Mandatory)]
4443
[string] $ModuleName,
4544

46-
# Folder where the built module is outputted. '.PSModule/module/MyModule'
45+
# Folder for the built module files. '.PSModule/module/MyModule'
4746
[Parameter(Mandatory)]
4847
[System.IO.DirectoryInfo] $ModuleOutputFolder
4948
)

‎.github/actions/Build-PSModule/src/helpers/Build/Get-PSModuleAliasesToExport.ps1‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function Get-PSModuleAliasesToExport {
22
<#
33
.SYNOPSIS
4-
Gets the aliases to export from the module manifest.
4+
Get the aliases to export from the module manifest.
55
66
.DESCRIPTION
7-
This function will get the aliases to export from the module manifest.
7+
Get-PSModuleAliasesToExport reads AliasesToExport from the module manifest.
88
99
.EXAMPLE
1010
Get-PSModuleAliasesToExport -SourceFolderPath 'C:\MyModule\src\MyModule'
@@ -13,7 +13,7 @@
1313
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope = 'Function', Justification = 'Want to just write to the console, not the pipeline.')]
1414
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Contains long links.')]
1515
param(
16-
# Path to the folder where the module source code is located.
16+
# Path to the module source folder.
1717
[Parameter(Mandatory)]
1818
[string] $SourceFolderPath
1919
)

‎.github/actions/Build-PSModule/src/helpers/Build/Get-PSModuleClassesToExport.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function Get-PSModuleClassesToExport {
22
<#
33
.SYNOPSIS
4-
Gets the classes to export from the module source code.
4+
Get the classes and enums to export from the module source code.
55
66
.DESCRIPTION
7-
This function will get the classes to export from the module source code.
7+
Get-PSModuleClassesToExport finds class and enum declarations in source files.
88
99
.EXAMPLE
1010
Get-PSModuleClassesToExport -SourceFolderPath 'C:\MyModule\src\MyModule'

‎.github/actions/Build-PSModule/src/helpers/Build/Get-PSModuleCmdletsToExport.ps1‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function Get-PSModuleCmdletsToExport {
22
<#
33
.SYNOPSIS
4-
Gets the cmdlets to export from the module manifest.
4+
Get the cmdlets to export from the module manifest.
55
66
.DESCRIPTION
7-
This function will get the cmdlets to export from the module manifest.
7+
Get-PSModuleCmdletsToExport reads CmdletsToExport from the module manifest.
88
99
.EXAMPLE
1010
Get-PSModuleCmdletsToExport -SourceFolderPath 'C:\MyModule\src\MyModule'
@@ -13,7 +13,7 @@
1313
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope = 'Function', Justification = 'Want to just write to the console, not the pipeline.')]
1414
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Contains long links.')]
1515
param(
16-
# Path to the folder where the module source code is located.
16+
# Path to the module source folder.
1717
[Parameter(Mandatory)]
1818
[string] $SourceFolderPath
1919
)

‎.github/actions/Build-PSModule/src/helpers/Build/Get-PSModuleFunctionsToExport.ps1‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function Get-PSModuleFunctionsToExport {
22
<#
33
.SYNOPSIS
4-
Gets the functions to export from the module manifest.
4+
Get the functions and filters to export from the module source code.
55
66
.DESCRIPTION
7-
This function will get the functions to export from the module manifest.
7+
Get-PSModuleFunctionsToExport reads public source files to identify the functions and filters to export.
88
99
.EXAMPLE
1010
Get-PSModuleFunctionsToExport -SourceFolderPath 'C:\MyModule\src\MyModule'
@@ -14,7 +14,7 @@
1414
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Contains long links.')]
1515
[OutputType([array])]
1616
param(
17-
# Path to the folder where the module source code is located.
17+
# Path to the module source folder.
1818
[Parameter(Mandatory)]
1919
[string] $SourceFolderPath
2020
)

0 commit comments

Comments
 (0)