Skip to content

Commit eb80695

Browse files
authored
Merge pull request #15 from tablackburn/chore/template-changelog
Add template-level CHANGELOG.md (CalVer)
2 parents 73334c9 + 2a29c6b commit eb80695

5 files changed

Lines changed: 62 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
11
# Changelog
22

3-
All notable changes to this project will be documented in this file.
3+
All notable changes to this template will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
and this project uses [Calendar Versioning](https://calver.org/) (`YYYY.MM.DD`).
7+
8+
For the changelog of a *module initialized from this template*, see the module's
9+
own `CHANGELOG.md` (generated from `CHANGELOG.template.md` during init).
710

811
## [Unreleased]
912

10-
## [0.1.0] - {{Date}}
13+
## [2026.04.29] - 2026-04-29
1114

1215
### Added
1316

14-
- Initial release
15-
- `Get-{{Prefix}}Example` - Example public function
17+
- SemVer-aware dependency version checks: new `tests/ManifestHelpers.psm1` exporting `Test-VersionConstraint`. `tests/Manifest.tests.ps1` now differentiates `RequiredVersion` / `ModuleVersion` / `MaximumVersion`, accepts both string and hashtable shapes in `requirements.psd1`, and detects duplicate `RequiredModules` entries.
18+
- README split: template-facing `README.md` (what GitHub visitors see) and module-facing `README.template.md` (substituted into `README.md` during init).
19+
- `docs/en-US/about_{{ModuleName}}.help.md` stub for `Get-Help about_<Module>`. `Initialize-Template.ps1` now also renames `{{ModuleName}}` files in `docs/en-US/`.
20+
- `.gitattributes` marking `docs/en-US/*` as `linguist-generated`.
21+
- `.markdownlint-cli2.jsonc` config (relax MD013 in tables/code, allow MD024 siblings, ignore generated docs and `instructions/`).
22+
23+
### Changed
24+
25+
- `PSScriptAnalyzerSettings.psd1`: replaced one-line `@{ IncludeRules = @('*') }` with the structured form (Include/Exclude/Rules + commented compat scaffold).
26+
- Bumped `PSScriptAnalyzer` 1.24.0 → 1.25.0.
27+
28+
### Fixed
29+
30+
- `tests/Help.tests.ps1`: replaced undefined `$parameterNames` with `$commandParameterNames` in the help-vs-code parameter check (was silently asserting against `$null`).
31+
- `{{ModuleName}}/{{ModuleName}}.psm1`: dot-source catch block now preserves the original `ErrorRecord` via bare `throw`. Previously the catch threw a new string (`"Unable to dot source ..."`), which wrapped the original exception in a fresh `ErrorRecord` and lost the underlying stack trace.
32+
33+
[Unreleased]: https://github.com/tablackburn/PowerShellModuleTemplate/compare/v2026.04.29...HEAD
34+
[2026.04.29]: https://github.com/tablackburn/PowerShellModuleTemplate/releases/tag/v2026.04.29

CHANGELOG.template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.1.0] - {{Date}}
11+
12+
### Added
13+
14+
- Initial release
15+
- `Get-{{Prefix}}Example` - Example public function

Initialize-Template.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ $filesToProcess = Get-ChildItem -Path $PSScriptRoot -Recurse -File | Where-Objec
180180
$_.FullName -notmatch '[\\/]Output[\\/]' -and
181181
$_.FullName -notmatch '[\\/]out[\\/]' -and
182182
$_.Name -ne 'Initialize-Template.ps1' -and
183+
$_.Name -ne 'CHANGELOG.md' -and
183184
$_.Extension -in @('.ps1', '.psm1', '.psd1', '.md', '.json', '.yml', '.yaml', '.xml', '.txt', '')
184185
}
185186

@@ -287,6 +288,15 @@ if (Test-Path -Path $readmeTemplate) {
287288
Write-Host ' Generated module README.md from template' -ForegroundColor Green
288289
}
289290

291+
# Replace template-facing CHANGELOG.md with the module-facing CHANGELOG.template.md
292+
# (placeholders inside CHANGELOG.template.md were already substituted by the file-processing loop above)
293+
$changelogTemplate = Join-Path -Path $PSScriptRoot -ChildPath 'CHANGELOG.template.md'
294+
$changelogPath = Join-Path -Path $PSScriptRoot -ChildPath 'CHANGELOG.md'
295+
if (Test-Path -Path $changelogTemplate) {
296+
Move-Item -Path $changelogTemplate -Destination $changelogPath -Force
297+
Write-Host ' Generated module CHANGELOG.md from template' -ForegroundColor Green
298+
}
299+
290300
# Initialize Git repository if requested
291301
if (-not $NoGitInit) {
292302
$gitFolder = Join-Path -Path $PSScriptRoot -ChildPath '.git'

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ The test suite runs against the `{{ModuleName}}` placeholder module to verify th
117117
- Git
118118
- (Optional) Docker for the devcontainer
119119

120+
## Changelog
121+
122+
See [CHANGELOG.md](CHANGELOG.md) for the template's version history. The template uses [Calendar Versioning](https://calver.org/) (`YYYY.MM.DD`) — the version reflects when a snapshot of the template was cut, not API compatibility.
123+
120124
## License
121125

122126
[MIT](LICENSE)

tests/Manifest.tests.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ BeforeDiscovery {
8686
}
8787
$manifestData = Test-ModuleManifest @testModuleManifestParameters
8888
$dependencies = $manifestData.RequiredModules
89+
90+
# When running on the un-initialized template, CHANGELOG.md tracks the template's
91+
# CalVer version (YYYY.MM.DD), which deliberately decouples from the manifest's
92+
# ModuleVersion. Skip the equality assertion in that case; downstream modules (post-init)
93+
# keep the assertion. Marker: CHANGELOG.template.md exists only pre-init —
94+
# Initialize-Template.ps1 moves it onto CHANGELOG.md during init. The marker survives
95+
# the init substitution loop because no token in the path matches a {{Placeholder}}.
96+
$isTemplate = Test-Path -LiteralPath (Join-Path -Path $Env:BHProjectPath -ChildPath 'CHANGELOG.template.md')
8997
}
9098
BeforeAll {
9199
# Check if the BHBuildOutput environment variable exists to determine if this test is running in a psake
@@ -180,7 +188,7 @@ Describe 'Module manifest' {
180188
$changelogVersion -as [Version] | Should -Not -BeNullOrEmpty
181189
}
182190

183-
It 'Changelog and manifest versions are the same' {
191+
It 'Changelog and manifest versions are the same' -Skip:$isTemplate {
184192
$changelogVersion -as [Version] | Should -Be ( $manifestData.Version -as [Version] )
185193
}
186194

0 commit comments

Comments
 (0)