|
1 | 1 | function Build-PSModuleRootModule { |
2 | 2 | <# |
3 | 3 | .SYNOPSIS |
4 | | - Compiles the module root module files. |
| 4 | + Build the root module file from source scripts. |
5 | 5 |
|
6 | 6 | .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: |
10 | 9 |
|
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: |
14 | 13 | 1. init |
15 | 14 | 2. classes/private |
16 | 15 | 3. classes/public |
17 | 16 | 4. functions/private |
18 | 17 | 5. functions/public |
19 | 18 | 6. variables/private |
20 | 19 | 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. |
25 | 24 | - `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. |
28 | 27 |
|
29 | 28 | .EXAMPLE |
30 | 29 | Build-PSModuleRootModule -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule' |
|
43 | 42 | [Parameter(Mandatory)] |
44 | 43 | [string] $ModuleName, |
45 | 44 |
|
46 | | - # Folder where the built module is outputted. '.PSModule/module/MyModule' |
| 45 | + # Folder for the built module files. '.PSModule/module/MyModule' |
47 | 46 | [Parameter(Mandatory)] |
48 | 47 | [System.IO.DirectoryInfo] $ModuleOutputFolder |
49 | 48 | ) |
|
0 commit comments