From bffb4f226eb0a6660bdfc5986bcca51938bc0a89 Mon Sep 17 00:00:00 2001 From: Manjunath Beli Date: Wed, 17 Sep 2025 10:01:38 -0500 Subject: [PATCH 1/4] Support PSFormatdata --- project.json | 2 +- src/private/Build-Module.ps1 | 4 +++- src/private/Build.Manifest.ps1 | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/project.json b/project.json index a31658c..cc5d3cb 100644 --- a/project.json +++ b/project.json @@ -1,7 +1,7 @@ { "ProjectName": "ModuleTools", "Description": "ModuleTools is a versatile, standalone PowerShell module builder. Create anything from simple to robust modules with ease. Built for CICD and Automation.", - "Version": "1.2.1", + "Version": "1.2.4-preview", "copyResourcesToModuleRoot": false, "Manifest": { "Author": "Manjunath Beli", diff --git a/src/private/Build-Module.ps1 b/src/private/Build-Module.ps1 index ba8b304..52af5ab 100644 --- a/src/private/Build-Module.ps1 +++ b/src/private/Build-Module.ps1 @@ -1,6 +1,8 @@ function Build-Module { - Write-Verbose 'Buidling module psm1 file' $data = Get-MTProjectInfo + $MTBuildVersion = (Get-Command Invoke-MTBuild).Version + Write-Verbose "Running ModuleTols Version: $MTBuildVersion" + Write-Verbose 'Buidling module psm1 file' Test-ProjectSchema -Schema Build | Out-Null $sb = [System.Text.StringBuilder]::new() diff --git a/src/private/Build.Manifest.ps1 b/src/private/Build.Manifest.ps1 index 956be1b..35de7a6 100644 --- a/src/private/Build.Manifest.ps1 +++ b/src/private/Build.Manifest.ps1 @@ -12,6 +12,12 @@ function Build-Manifest { $aliasToExport += Get-AliasInFunctionFromFile -filePath $_ } + ## Import Formatting (if any) + $FormatsToProcess = @() + Get-ChildItem -Path $data.ResourcesDir -File -Filter '*.ps1xml' -ErrorAction SilentlyContinue | ForEach-Object { + $FormatsToProcess += $_.Name + } + $ManfiestAllowedParams = (Get-Command New-ModuleManifest).Parameters.Keys $sv = [semver]$data.Version $ParmsManifest = @{ @@ -21,8 +27,10 @@ function Build-Manifest { AliasesToExport = $aliasToExport RootModule = "$($data.ProjectName).psm1" ModuleVersion = [version]$sv + FormatsToProcess = $FormatsToProcess } - + + ## Release lable if ($sv.PreReleaseLabel) { $ParmsManifest['Prerelease'] = $sv.PreReleaseLabel } From fa69a03637d5a5f18e667bfc2ce4c39d38b8ff1b Mon Sep 17 00:00:00 2001 From: Manjunath Beli Date: Wed, 17 Sep 2025 10:08:29 -0500 Subject: [PATCH 2/4] handle resource folder --- project.json | 2 +- src/private/Build.Manifest.ps1 | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/project.json b/project.json index cc5d3cb..cfcf14f 100644 --- a/project.json +++ b/project.json @@ -1,7 +1,7 @@ { "ProjectName": "ModuleTools", "Description": "ModuleTools is a versatile, standalone PowerShell module builder. Create anything from simple to robust modules with ease. Built for CICD and Automation.", - "Version": "1.2.4-preview", + "Version": "1.2.5-preview", "copyResourcesToModuleRoot": false, "Manifest": { "Author": "Manjunath Beli", diff --git a/src/private/Build.Manifest.ps1 b/src/private/Build.Manifest.ps1 index 35de7a6..c127374 100644 --- a/src/private/Build.Manifest.ps1 +++ b/src/private/Build.Manifest.ps1 @@ -15,7 +15,11 @@ function Build-Manifest { ## Import Formatting (if any) $FormatsToProcess = @() Get-ChildItem -Path $data.ResourcesDir -File -Filter '*.ps1xml' -ErrorAction SilentlyContinue | ForEach-Object { - $FormatsToProcess += $_.Name + if ($data.copyResourcesToModuleRoot) { + $FormatsToProcess += $_.Name + } else { + $FormatsToProcess += Join-Path -Path 'resources' -ChildPath $_.Name + } } $ManfiestAllowedParams = (Get-Command New-ModuleManifest).Parameters.Keys From 9aac0f24787a98956e98746add7ac10439b99d65 Mon Sep 17 00:00:00 2001 From: Manjunath Beli Date: Tue, 23 Sep 2025 08:33:10 -0500 Subject: [PATCH 3/4] Cleaner Project Info output --- src/public/GetMTProjectInfo.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/public/GetMTProjectInfo.ps1 b/src/public/GetMTProjectInfo.ps1 index e41247a..23c9f88 100644 --- a/src/public/GetMTProjectInfo.ps1 +++ b/src/public/GetMTProjectInfo.ps1 @@ -42,5 +42,6 @@ function Get-MTProjectInfo { $Out['ModuleFilePSM1'] = [System.IO.Path]::Join($Out.OutputModuleDir, "$ProjectName.psm1") $Out['ManifestFilePSD1'] = [System.IO.Path]::Join($Out.OutputModuleDir, "$ProjectName.psd1") - return $Out + $Output = [pscustomobject]$Out | Add-Member -TypeName MTProjectInfo -PassThru + return $Output } \ No newline at end of file From 1b6eb04b7754eb2113079a6631f6f42258608c68 Mon Sep 17 00:00:00 2001 From: Manjunath Beli Date: Tue, 23 Sep 2025 09:45:56 -0500 Subject: [PATCH 4/4] Add psformat data support --- CHANGELOG.md | 4 ++++ project.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ba0457..613a940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## [1.3.0] - 2025-09-23 + +- Added support for `ps1xml1` format data. Place it in resources folder with `Name.format.ps1xml` to be automatically added as format file and imported in module manifest + ## [1.2.0] - 2025-09-17 ### Added diff --git a/project.json b/project.json index cfcf14f..c400f70 100644 --- a/project.json +++ b/project.json @@ -1,7 +1,7 @@ { "ProjectName": "ModuleTools", "Description": "ModuleTools is a versatile, standalone PowerShell module builder. Create anything from simple to robust modules with ease. Built for CICD and Automation.", - "Version": "1.2.5-preview", + "Version": "1.3.0", "copyResourcesToModuleRoot": false, "Manifest": { "Author": "Manjunath Beli",