Closed FH-Inway closed 1 month ago
Solution is currently running through the pipeline: https://github.com/PowershellFrameworkCollective/PSModuleDevelopment/pull/206 Worked locally, had some extra-issues in Azure DevOps, hoping those get solved with the latest update. But either way, on it today until the issue submits :)
Great stuff, saw the pr earlier and have been reading up on the templating engine.
While playing around with it on GitHub codespaces (also trying to see if #202 was resolved), I got a new error. Sorry to be piling on here, hopefully it's the same root cause. This should have the necessary error information (don't worry about the first part, fun starts in section "Use a template to create a new module"): https://github.com/FH-Inway/PSModuleDevelopment/blob/b6aa4e0b85c65cec98f5e1ce28e9cfde29d29697/learn/notebooks/Get-Started.ipynb
Yeah, that's the exact thing I was working on. It should be gone now, but Azure DevOps disagreed so I've been piling on another fun feature of PSFramework to work around that:
Register-PSFArgumentTransformationScriptblock -Name 'Test.Answer' -Scriptblock {
if ($_ -eq 42) { "Answer" }
else { $_ }
}
function Get-Test {
[CmdletBinding()]
param (
[PSFramework.Utility.ScriptTransformation('Test.Answer', [string])]
[string]
$Answer
)
$Answer
}
Get-Test 23 # 23
Get-Test 42 # Answer
Same thing for that specific parameter that was failing :) Admittedly, I could have just giving up on that parameter requiring the type, since it could have just taken the deserialized object for what the command does, but given where I want to go with vNEXT, that's not as much of an option as I'd have liked. Yeah, the issue just now has spurned me into action on finally getting back to my plans from 2018 that you can find in the issues history. Holy moly does time bass when you're having fun nerding out ...
The tests are sooo worth it, given how I keep messing up :D Really, thank you for your effort here, helping me fix that, much appreciated
Happy to help :smile:
Still getting to know all the PowerShell magic you are doing here, the more I learn, the cooler it gets 😎
Just got ./dev/launch.ps1 -Local
to work in GitHub Codespaces (#208). Running Invoke-PSMDTemplate
with your latest changes is looking good.
Once more into the breach, now that I have found that PSFramework's ScriptTransformation-attribute has a validation error that does not accept child-types as result, even though they would be correct ... Going with the "commented-out" route and hope I don't forget to undo it once the fix in PSframework is live (not today). New issue to track that on the other side, in case you now want to use that attribute yourself and have a case where that would be a problem :)
I wasn't even aware such an attribute exists. Or that there are transformation attributes 😃 Got some new stuff to learn.
Regarding the 2018 plans, I believe you are referring to the issues with the Templatesv2 label?
Yepp. Mostly the roadmap one, which summarizes the rest. looking to add a lot more flexibility, ideally without costing complexity for those that don't need them (what currently works should keep working)
Aaaaand ... the fix is out. Should work again as advertised :) v2.2.12.172
Confirmed, it works again. Thanks again for the quick fix :)
As mentioned in https://github.com/PowershellFrameworkCollective/psframework/issues/645#issuecomment-2395040053 , after updating to 2.2.12.171 of PSModuleDevelopment, the
Invoke-PSMDTemplate
command started generating files where part of the content is missing.See Test Invoke-PSMDTemplate for a comparison. Both of the following files were generated with the following command:
Invoke-PSMDTemplate CommandTest -Name Invoke-PSMDTemplate
The issue occurs on Windows Server 2022 with Windows PowerShell 5.1.