Skip to content

Commit d0a51ce

Browse files
committed
Added Classes
1 parent 58796c8 commit d0a51ce

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

CHANGELOG.md

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

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

5+
## [1.1.4-preview] - 2025-09-14
6+
- Added support for classes directory inside src
7+
- New-MTModule generates classes directory during fresh project
8+
- `classes` directory should include `.ps1` files which contain enums and classes
9+
510
## [1.1.3] - 2025-09-14
611

712
### Added

project.json

Lines changed: 2 additions & 2 deletions
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.1.3",
4+
"Version": "1.1.4-preview",
55
"copyResourcesToModuleRoot": false,
66
"Manifest": {
77
"Author": "Manjunath Beli",
@@ -19,4 +19,4 @@
1919
"Verbosity": "Detailed"
2020
}
2121
}
22-
}
22+
}

src/private/Build-Module.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ function Build-Module {
55

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

8+
# Classes Folder
9+
$files = Get-ChildItem -Path $data.ClassesDir -Filter *.ps1 -ErrorAction SilentlyContinue
10+
$files | ForEach-Object {
11+
$sb.AppendLine([IO.File]::ReadAllText($_.FullName)) | Out-Null
12+
}
13+
814
# Public Folder
915
$files = Get-ChildItem -Path $data.PublicDir -Filter *.ps1
1016
$files | ForEach-Object {

src/public/GetMTProjectInfo.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function Get-MTProjectInfo {
3535
$Out['ProjectRoot'] = $ProjectRoot
3636
$Out['PublicDir'] = [System.IO.Path]::Join($ProjectRoot, 'src', 'public')
3737
$Out['PrivateDir'] = [System.IO.Path]::Join($ProjectRoot, 'src', 'private')
38+
$Out['ClassesDir'] = [System.IO.Path]::Join($ProjectRoot, 'src', 'classes')
39+
$Out['ResourcesDir'] = [System.IO.Path]::Join($ProjectRoot, 'src', 'resources')
3840
$Out['OutputDir'] = [System.IO.Path]::Join($ProjectRoot, 'dist')
3941
$Out['OutputModuleDir'] = [System.IO.Path]::Join($Out.OutputDir, $ProjectName)
4042
$Out['ModuleFilePSM1'] = [System.IO.Path]::Join($Out.OutputModuleDir, "$ProjectName.psm1")

src/public/NewMTModule.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function New-MTModule {
9090
$DirPrivate = Join-Path -Path $DirSrc -ChildPath 'private'
9191
$DirPublic = Join-Path -Path $DirSrc -ChildPath 'public'
9292
$DirResources = Join-Path -Path $DirSrc -ChildPath 'resources'
93+
$DirClasses = Join-Path -Path $DirSrc -ChildPath 'classes'
9394
$DirTests = Join-Path -Path $DirProject -ChildPath 'tests'
9495
$ProjectJSONFile = Join-Path $DirProject -ChildPath 'project.json'
9596

@@ -100,7 +101,7 @@ function New-MTModule {
100101

101102
Write-Message "`nStarted Module Scaffolding" -color Green
102103
Write-Message 'Setting up Directories'
103-
($DirProject, $DirSrc, $DirPrivate, $DirPublic, $DirResources) | ForEach-Object {
104+
($DirProject, $DirSrc, $DirPrivate, $DirPublic, $DirResources, $DirClasses) | ForEach-Object {
104105
'Creating Directory: {0}' -f $_ | Write-Verbose
105106
New-Item -ItemType Directory -Path $_ | Out-Null
106107
}

src/public/UpdateModVersion.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@ function Update-MTModuleVersion {
3737
$jsonContent = Get-Content -Path $data.ProjecJSON | ConvertFrom-Json
3838

3939
[semver]$CurrentVersion = $jsonContent.Version
40-
41-
$Major = ($Label -eq 'Major') ? ($CurrentVersion.Major + 1) : $CurrentVersion.Major
42-
$Minor = ($Label -eq 'Minor') ? ($CurrentVersion.Minor + 1) : $CurrentVersion.Minor
43-
$Patch = ($Label -eq 'Patch') ? ($CurrentVersion.Patch + 1) : $CurrentVersion.Patch
4440

41+
if ($Label -eq 'Major') {
42+
$Major = $CurrentVersion.Major + 1
43+
$Minor = 0
44+
$Patch = 0
45+
} elseif ($Label -eq 'Minor') {
46+
$Minor = $CurrentVersion.Minor + 1
47+
$Patch = 0
48+
} elseif ($Label -eq 'Patch') {
49+
$Patch = $CurrentVersion.Patch + 1
50+
}
51+
4552
if ($PreviewRelease) {
4653
$ReleaseType = 'preview'
4754
} elseif ($StableRelease) {

0 commit comments

Comments
 (0)