Skip to content

Commit fb8d43c

Browse files
authored
Merge pull request #17 from belibug/psformatting
Psformatting
2 parents 6fb9714 + 1b6eb04 commit fb8d43c

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.3.0] - 2025-09-23
6+
7+
- 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
8+
59
## [1.2.0] - 2025-09-17
610

711
### Added

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.2.1",
4+
"Version": "1.3.0",
55
"copyResourcesToModuleRoot": false,
66
"Manifest": {
77
"Author": "Manjunath Beli",

src/private/Build-Module.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
function Build-Module {
2-
Write-Verbose 'Buidling module psm1 file'
32
$data = Get-MTProjectInfo
3+
$MTBuildVersion = (Get-Command Invoke-MTBuild).Version
4+
Write-Verbose "Running ModuleTols Version: $MTBuildVersion"
5+
Write-Verbose 'Buidling module psm1 file'
46
Test-ProjectSchema -Schema Build | Out-Null
57

68
$sb = [System.Text.StringBuilder]::new()

src/private/Build.Manifest.ps1

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

15+
## Import Formatting (if any)
16+
$FormatsToProcess = @()
17+
Get-ChildItem -Path $data.ResourcesDir -File -Filter '*.ps1xml' -ErrorAction SilentlyContinue | ForEach-Object {
18+
if ($data.copyResourcesToModuleRoot) {
19+
$FormatsToProcess += $_.Name
20+
} else {
21+
$FormatsToProcess += Join-Path -Path 'resources' -ChildPath $_.Name
22+
}
23+
}
24+
1525
$ManfiestAllowedParams = (Get-Command New-ModuleManifest).Parameters.Keys
1626
$sv = [semver]$data.Version
1727
$ParmsManifest = @{
@@ -21,8 +31,10 @@ function Build-Manifest {
2131
AliasesToExport = $aliasToExport
2232
RootModule = "$($data.ProjectName).psm1"
2333
ModuleVersion = [version]$sv
34+
FormatsToProcess = $FormatsToProcess
2435
}
25-
36+
37+
## Release lable
2638
if ($sv.PreReleaseLabel) {
2739
$ParmsManifest['Prerelease'] = $sv.PreReleaseLabel
2840
}

src/public/GetMTProjectInfo.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ function Get-MTProjectInfo {
4242
$Out['ModuleFilePSM1'] = [System.IO.Path]::Join($Out.OutputModuleDir, "$ProjectName.psm1")
4343
$Out['ManifestFilePSD1'] = [System.IO.Path]::Join($Out.OutputModuleDir, "$ProjectName.psd1")
4444

45-
return $Out
45+
$Output = [pscustomobject]$Out | Add-Member -TypeName MTProjectInfo -PassThru
46+
return $Output
4647
}

0 commit comments

Comments
 (0)