Skip to content

Commit 52a2a7d

Browse files
committed
Classes and Enums
1 parent d0a51ce commit 52a2a7d

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

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

5-
## [1.1.4-preview] - 2025-09-14
5+
## [1.2.0] - 2025-09-17
6+
7+
### Added
68
- Added support for classes directory inside src
79
- New-MTModule generates classes directory during fresh project
810
- `classes` directory should include `.ps1` files which contain enums and classes
911

12+
### Fixed
13+
- Version upgrade using update-mtmoduleversion now support build tags. Improvements to semver versioning.
14+
1015
## [1.1.3] - 2025-09-14
1116

1217
### Added

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ All the Module files should be in inside `src` folder
4545
│ └──  New-PublicFunction.ps1
4646
├──  resources
4747
│ └──  some-config.json
48-
└──  tests
49-
└──  Pester.Some.Tests.ps1
48+
└──  classes
49+
└──  Person.classes.ps1
50+
└──  Person.enums.ps1
5051
```
5152

5253
### Dist Folder
@@ -71,6 +72,7 @@ Run `New-MTModule` to generate the scaffolding; this will also create the `proje
7172
- Place all your functions in the `private` and `public` folders within the `src` directory.
7273
- All functions in the `public` folder are exported during the module build.
7374
- All functions in the `private` folder are accessible internally within the module but are not exposed outside the module.
75+
- All `ps1` files in `classes` folder contains classes and enums, that are processed and placed in topmost of generated `psm1` files
7476
- Contents of the `src/resources` folder will be handled based on setting `copyResourcesToModuleRoot`
7577

7678
#### Resources Folder
@@ -149,12 +151,15 @@ All the pester configurations are stored in `project.json`, simply run `Invoke-M
149151

150152
A simple command to update the module version by modifying the values in `project.json`. You can also manually edit the file in your favorite editor. This command makes it easy to update the semantic version.
151153

152-
- Running `Update-MTModuleVersion` without any parameters will update the patch version (e.g., 1.0.1 -> 1.0.2).
153-
- Running `Update-MTModuleVersion -Label Major` updates the major version (e.g., 1.0.1 -> 2.0.1).
154-
- Running `Update-MTModuleVersion -Label Minor` updates the minor version (e.g., 1.0.1 -> 1.1.1).
154+
- Running `Update-MTModuleVersion` without any parameters will update the patch version (e.g., 1.2.3 -> 1.2.4)
155+
- Running `Update-MTModuleVersion -Label Major` updates the major version and resets Minor, Patch to 0 (e.g., 1.2.1 -> 2.0.0)
156+
- Running `Update-MTModuleVersion -Label Minor` updates the minor version and resets Patch to 0 (e.g., 1.2.3 -> 1.3.0)
155157

156158
## Advanced - Use it in Github Actions
157159

160+
> [!TIP]
161+
> This repository uses Github actions to run tests and publish to PowerShell Gallery, use it as reference.
162+
158163
This is not required for local module builds, if you are running github actions, use the following yaml workflow template to test, build and publish module which helps to automate the process of:
159164

160165
1. Checking out the repository code.
@@ -202,12 +207,12 @@ jobs:
202207
203208
## 📝 Requirement
204209
205-
- Only tested on PowerShell 7.4, most likely wont work on 5.1
206-
- No depenedencies. This module doesn’t depend on any other module.
210+
- Only tested on PowerShell 7.4, ~most likely~ will not work on 5.1. Underlying module can still support older version, only the ModuleTools builder wont work on older version.
211+
- No depenedencies. This module doesn’t depend on any other module. Completely self contained
207212
208213
## ✅ ToDo
209214
210-
- [ ] Support Classes and Enums in modules
215+
- [ ] Add more tests
211216
212217
## 🤝 Contributing
213218

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.4-preview",
4+
"Version": "1.2.0",
55
"copyResourcesToModuleRoot": false,
66
"Manifest": {
77
"Author": "Manjunath Beli",
@@ -19,4 +19,4 @@
1919
"Verbosity": "Detailed"
2020
}
2121
}
22-
}
22+
}

src/public/UpdateModVersion.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ function Update-MTModuleVersion {
4343
$Minor = 0
4444
$Patch = 0
4545
} elseif ($Label -eq 'Minor') {
46+
$Major = $CurrentVersion.Major
4647
$Minor = $CurrentVersion.Minor + 1
4748
$Patch = 0
4849
} elseif ($Label -eq 'Patch') {
50+
$Major = $CurrentVersion.Major
51+
$Minor = $CurrentVersion.Minor
4952
$Patch = $CurrentVersion.Patch + 1
5053
}
5154

0 commit comments

Comments
 (0)