Replace null-coalescing operators with PS5.1-compatible syntax#443
Merged
HeyItsGilbert merged 4 commits intov2from Feb 12, 2026
Merged
Replace null-coalescing operators with PS5.1-compatible syntax#443HeyItsGilbert merged 4 commits intov2from
HeyItsGilbert merged 4 commits intov2from
Conversation
Copilot
AI
changed the title
[WIP] Fix Plaster v2.0.0-alpha for Windows compatibility
Replace null-coalescing operators with PS5.1-compatible syntax
Feb 12, 2026
3b24123 to
4bde3a8
Compare
Test Results 3 files 189 suites 35s ⏱️ Results for commit e019b41. ♻️ This comment has been updated with latest results. |
Co-authored-by: HeyItsGilbert <615265+HeyItsGilbert@users.noreply.github.com>
…and build metadata
955ce7d to
e019b41
Compare
8 tasks
psjamesp
added a commit
that referenced
this pull request
Apr 13, 2026
…zed build/test (#449) ## Overview This PR lands the long-running `v2` branch into `master`, shipping Plaster **2.0.0-alpha1**. It's a large drop (~50 commits, ~115 files, +11.5k / -3.2k) and touches nearly every part of the project, so the sections below break it down by theme rather than by commit. Target version: `Plaster.psd1` → `ModuleVersion = '2.0.0'`, `Prerelease = 'alpha1'`. ## Highlights - **JSON manifest support** — Plaster templates can now be authored as JSON in addition to XML, with a full `plaster-manifest-v2.json` schema, bidirectional conversion, and validation. - **Modular source layout** — the monolithic `Invoke-Plaster.ps1` / `NewPlasterManifest.ps1` / `GetModuleExtension.ps1` files have been decomposed into per-function `Public/` and `Private/` files. - **PowerShell 7.x + cross-platform** — Windows, Linux, macOS all supported; minimum PS version is now 5.1. - **Pester 5.x test suite** — large coverage expansion with per-function tests. - **Modernized build** — psake + PowerShellBuild + PSDepend, with a `-Bootstrap` switch for clean CI installs. - **Publish workflow** rewired end-to-end and validated against GitHub-hosted runners. ## What changed ### Module architecture - Split `Plaster/InvokePlaster.ps1` (1500+ lines), `Plaster/NewPlasterManifest.ps1`, and `Plaster/GetModuleExtension.ps1` into discrete `Public/` and `Private/` function files. - New `Plaster/Private/` helpers for things that were previously inline: `ConvertFrom-JsonManifest`, `ConvertTo-JsonManifest`, `ConvertFrom-JsonContentAction`, `ConvertTo-JsonContentAction`, `Copy-FileWithConflictDetection`, `Expand-FileSourceSpec`, `Get-ManifestsUnderPath`, `Get-PlasterManifestType`, `Initialize-PredefinedVariables`, `Invoke-ExpressionImpl`, `Invoke-PlasterOperation`, `New-ConstrainedRunspace`, `Resolve-ModuleVersionString`, `Resolve-ProcessParameter`, `Start-Process*`, `Write-PlasterLog`, and friends. - `Plaster.psm1` / `Plaster.psd1` updated to match the new layout. ### JSON manifest support (new) - `Plaster/Schema/plaster-manifest-v2.json` — full JSON Schema for v2 manifests. - JSON ↔ internal-model converters: `ConvertFrom-JsonManifest`, `ConvertTo-JsonManifest`, plus content-action variants. - `Get-PlasterManifestType` detects XML vs JSON manifests; `Test-PlasterManifest` validates both. - Example JSON manifests under `examples/` (`plasterManifest.json`, `plasterManifest-validatePattern.json`, `plasterManifest_fr-FR.json`). - Fixed error handling around file and template actions in JSON flow. ### Cross-platform / PS7 - Minimum PowerShell version raised to 5.1; null-coalescing operators removed from hot paths for PS5.1 compatibility (#443). - Default encoding changed from `Default` to `UTF-8-NoBOM`. - Path separator handling normalized; constrained-runspace compatibility fixes for PS7. - Parameter default value storage fixed on non-Windows. ### Tests - Migrated to **Pester 5.x** (breaking change for test authors). - New per-function test files: `Get-ModuleExtension.Tests.ps1`, `Get-PlasterManifestPathForCulture.Tests.ps1`, `Initialize-PredefinedVariables.Tests.ps1`, `Resolve-ModuleVersionString.Tests.ps1`, `New-PlasterManifest.Tests.ps1`, etc. - Added `Help.tests.ps1`, `Manifest.tests.ps1`, `Meta.tests.ps1`, `MetaFixers.psm1` (imported from Stucco). - Large fixture added for module resolution tests (`tests/Fixtures/ModuleList.xml`). - Conditional-attribute evaluation tests fixed (#445). ### Build & tooling - `build.ps1` refactored for cleaner parameter handling, with `-Task`, `-Bootstrap`, and `-Help` parameter sets. - `-Bootstrap` provisions PSDepend (pinned to PowerShellGet v2), then runs a try-import-first-then-install pattern against `requirements.psd1`. - `requirements.psd1` pins PSDepend 0.3.8, Pester 5.7.1, psake 4.9.1, BuildHelpers 2.0.16, PowerShellBuild 0.7.2, PSScriptAnalyzer 1.24.0. - `psakeFile.ps1` delegates to PowerShellBuild; `CopyDirectories` configured for `en-US`, `Schema`, `Templates`. - `debugHarness.ps1` refactored for the new module layout. - `.vscode/` tasks + settings refreshed; `.markdownlint.json` + `cspell.json` added. ### CI / publish workflow - `.github/workflows/publish.yaml` now runs on `windows-latest`, uses `ModuleFast-action` to pre-stage deps, and invokes `./build.ps1 -Task Publish -Bootstrap`. - `.github/workflows/PesterReports.yml` updated permissions and action versions. - Dead placeholder \`internal-nuget-repo\` registration removed from the bootstrap path (was failing \`Register-PSRepository\` URI validation on GitHub runners). ### Docs - README rewritten for v2. - CHANGELOG reformatted to Keep a Changelog. - Logo updated to make the 2.0 branding clearer. - Examples directory expanded. ## Breaking changes - **Minimum PowerShell version** is now 5.1 (was 3.0). - **Test framework** is Pester 5.x — any downstream tests authored against Pester 3/4 will need updating. - **Default encoding** changed to `UTF-8-NoBOM`. - Internal module layout changed significantly; anything dot-sourcing Plaster internals by path will break (public API is unchanged). ## Test plan - [ ] CI green on `v2` (publish workflow dry-run + Pester reports) - [ ] \`./build.ps1 -Bootstrap -Task Test\` passes locally on Windows PS 5.1 - [ ] \`./build.ps1 -Bootstrap -Task Test\` passes on Windows PS 7 - [ ] Smoke test on Linux / macOS (PS 7) - [ ] \`Invoke-Plaster\` against an XML manifest still works (regression) - [ ] \`Invoke-Plaster\` against a JSON manifest works end-to-end - [ ] \`Test-PlasterManifest\` validates both XML and JSON manifests - [ ] Publish workflow successfully pushes \`2.0.0-alpha1\` to PSGallery when manually dispatched 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plaster v2.0.0-alpha uses the null-coalescing operator (
??) introduced in PowerShell 7.0, breaking compatibility with PowerShell 5.1 as specified in the module manifest.Changes
Write-PlasterLog.ps1
??operators with conditional expressions compatible with PS5.1+Plaster.psm1
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
www.powershellgallery.com/usr/bin/pwsh pwsh -NoProfile -File ./build.ps1 -Bootstrap(dns block)/usr/bin/pwsh pwsh -NoProfile -Command Register-PSRepository -Default -ErrorAction SilentlyContinue Get-PSRepository(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.