Skip to content

Commit 519af99

Browse files
committed
Support importing types.ps1xml files to manifest
1 parent 2843b1d commit 519af99

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ The `resources` folder within the `src` directory is intended for including any
8181

8282
- **Configuration files**: Store any JSON, XML, or other configuration files needed by your module.
8383
- **Script files**: Place any scripts that are used by your functions or modules, but are not directly part of the public or private functions.
84-
- **formatdata files**: Store `Type.format.ps1xml` file for custom format data types to be imported to manifest
84+
- **formatdata files**: Store `Example.Format.ps1xml` file for custom format data types to be imported to manifest
85+
- **types files**: Store `Example.Types.ps1xml` file for custom format data types to be imported to manifest
8586
- **Documentation files**: Include any supplementary documentation that supports the usage or development of the module.
8687
- **Data files**: Store any data files that are used by your module, such as CSV or JSON files.
8788
- **Subfolder**: Include any additional folders and their content to be included with the module, such as dependant Modules, APIs, DLLs, etc... organized by a subfolder.

project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ProjectName": "ModuleTools",
33
"Description": "ModuleTools is a versatile, standalone PowerShell module builder. Create anything from simple to robust modules with ease. Built for CICD and Automation.",
4-
"Version": "1.3.0",
4+
"Version": "1.4.0",
55
"copyResourcesToModuleRoot": false,
66
"Manifest": {
77
"Author": "Manjunath Beli",

src/private/Build.Manifest.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,26 @@ function Build-Manifest {
1212
$aliasToExport += Get-AliasInFunctionFromFile -filePath $_
1313
}
1414

15-
## Import Formatting (if any)
15+
## Import Format.ps1xml (if any)
1616
$FormatsToProcess = @()
17-
Get-ChildItem -Path $data.ResourcesDir -File -Filter '*.ps1xml' -ErrorAction SilentlyContinue | ForEach-Object {
17+
Get-ChildItem -Path $data.ResourcesDir -File -Filter '*Format.ps1xml' -ErrorAction SilentlyContinue | ForEach-Object {
1818
if ($data.copyResourcesToModuleRoot) {
1919
$FormatsToProcess += $_.Name
2020
} else {
2121
$FormatsToProcess += Join-Path -Path 'resources' -ChildPath $_.Name
2222
}
2323
}
2424

25+
## Import Types.ps1xml1 (if any)
26+
$FormatsToProcess = @()
27+
Get-ChildItem -Path $data.ResourcesDir -File -Filter '*Types.ps1xml' -ErrorAction SilentlyContinue | ForEach-Object {
28+
if ($data.copyResourcesToModuleRoot) {
29+
$TypesToProcess += $_.Name
30+
} else {
31+
$TypesToProcess += Join-Path -Path 'resources' -ChildPath $_.Name
32+
}
33+
}
34+
2535
$ManfiestAllowedParams = (Get-Command New-ModuleManifest).Parameters.Keys
2636
$sv = [semver]$data.Version
2737
$ParmsManifest = @{

0 commit comments

Comments
 (0)