rough draft, refactor and cleanup
Hey - was playing around with your module a bit.
i've gone through a bit of the code and tried to simplify and add support for relative paths among other things.
i have changed quite a bit, i've tried to test as much as possible, all the examples appear to work atleast and the xUnit test pass.
I would like to implement output images as a stream instead of always saving to file.
is this anything that your interested in?
I'm not done with the pr yet, but wanted to get an idea on what you thought.
with the amount of libraries shipped it would probably help to implement an assembly load context.
For sure :-) Keep it up. I would gladly have some support on it. And yes ALC would be great. I actually wanted to move most of it to binary module instead of hybrid module, similar to what I did in Mailozaurr 2.0 or DesktopManager
Since majority of code is already in C#, so it would make sense to convert it to cmdlets instead of functions. What do you think?
yea i don't think converting this to a binary module would be too much work, the functions are fairly simple most of the heavy lifting is already in c#.
i'll see if i have some time to look at that as well.
If not, i'm fine with whatever. Better slow and steady then big and get stuck ;)
Questions,
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net48;net6.0;net7.0</TargetFrameworks>
Would it not be enough to target net472 or netstandard2.0
And net8.0
This would allow it to run in 5.1 and 7.4+, which are the supported versions.
Doing net8.0 would enable upgrading versions of alot of the libraries
Yes. Drop all not supported versions. Doesnt make sense to keep old ones.
I've managed to figure out the ALC + Assembly Resolver thing (pretty much yoinked jborean93's with some tweaks for the resolver), did some work on my Sixel module to add 5.1 support so should be fairly easy to copy that here as well.
Does ALC allows me to continue using ImagePlayground as C# nuget? My goal in 99% of my project is that I create a library XXX that I can reuse in C# projects as a nugget, and then library XXX.PowerShell where it exposes stuff to PowerShell - hopefully with ALC. WIll that continue working like that? Can I publish nuget as I was planning to, or it's going to be an issue?
ImagePlayground isn't on nuget?
It should be possible, but im not too familiar with publishing on nuget.
The ALC would be similar to how you have the Assembly resolver today
Not yet, but i planned to publish it once the code from powershell is moved to C#
My goal for most of my projects that do this hybrid stuff is to have it work in both world ;)
I've rebuild the version for v2 in C# directly. I added some of the stuff you wanted, some new stuff, could you please check if it's up to your standard ? :-)
I've rebuild the version for v2 in C# directly. I added some of the stuff you wanted, some new stuff, could you please check if it's up to your standard ? :-)
i pulled down master branch, just did a quick test.. seems to build fine but think some step is missing?
i'll test some more tomorrow..
would be nice in the build script if it was changed to =>
Import-Module PSPublishModule -Force -ErrorAction Stop
PSPublishModule\Build-Module -ModuleName 'ImagePlayground'
^ that way it wont conflict with ModuleBuilder if someone has it installed.
also, personal preference but i would prefer the build script not touch my installed modules. better it build to a folder inside the repo that can be excluded in the .gitignore
this way you can always compare to installed version.. when it fails like now i dont have a working version at all.
log
[i] Preparing structure
[-] Deleting old module (Desktop destination) C:\Users\Andree\Documents\WindowsPowerShell\Modules\ImagePlayground
[-] Deleting old module (Desktop destination) C:\Users\Andree\Documents\WindowsPowerShell\Modules\ImagePlayground [Time: 00:00:00.0023477]
[-] Deleting old module (Core destination) C:\Users\Andree\Documents\PowerShell\Modules\ImagePlayground
[-] Deleting old module (Core destination) C:\Users\Andree\Documents\PowerShell\Modules\ImagePlayground [Time: 00:00:00.0010571]
[-] Cleaning up temporary path C:\Users\Andree\AppData\Local\Temp\ImagePlayground
[-] Cleaning up temporary path C:\Users\Andree\AppData\Local\Temp\ImagePlayground [Time: 00:00:00.0197736]
[-] Cleaning up temporary path C:\Users\Andree\AppData\Local\Temp\ImagePlayground_TEMP_3013546310
[-] Cleaning up temporary path C:\Users\Andree\AppData\Local\Temp\ImagePlayground_TEMP_3013546310 [Time: 00:00:00.0026737]
[i] Preparing structure [Time: 00:00:00.0345814]
[+] Preparing files and folders variables
[+] Preparing files and folders variables [Time: 00:00:00.5054130]
[i] Preparing function and aliases names
[i] Preparing function and aliases names [Time: 00:00:00.0104511]
[i] Checking for duplicates in funcions, aliases and cmdlets
[i] Checking for duplicates in funcions, aliases and cmdlets [Time: 00:00:00.0183816]
[i] Verifying created PSD1 is readable
[i] Verifying created PSD1 is readable [Time: 00:00:00.0019148]
[+] Reading file content - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psd1
[+] Reading file content - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psd1 [Time: 00:00:00.0024607]
[+] Formatting file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psd1
[+] Formatting file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psd1 [Time: 00:00:00.0890293]
[+] Saving file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psd1
[+] Saving file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psd1 [Time: 00:00:00.0024364]
[+] Reading file content - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psm1
[+] Reading file content - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psm1 [Time: 00:00:00.0004378]
[+] Formatting file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psm1
[+] Formatting file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psm1 [Time: 00:00:00.0189895]
[+] Saving file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psm1
[+] Saving file - D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psm1 [Time: 00:00:00.0005420]
[i] Module Build Completed [Time Total: 0 days, 0 hours, 0 minutes, 7 seconds, 547 milliseconds]
ipmo ImagePlayground
Import-Module: The specified module 'ImagePlayground' was not loaded because no valid module file was found in any module directory.
ipmo .\ImagePlayground.psd1 -Debug -Verbose
VERBOSE: Loading module from path 'D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psd1'.
VERBOSE: Loading module from path 'D:\Code\OtherRepos\ImagePlayground\ImagePlayground.psm1'.
Resolve-Path: Cannot find path 'D:\Code\OtherRepos\ImagePlayground\Sources\ImagePlayground.PowerShell\bin\Debug\net8.0\ImagePlayground.PowerShell.dll' because it does not exist.
WARNING: Development mode: Using binaries from
well the Build-Module conflict I know, but that's an easy fix, remove the other builder ;p
As for the files being deleted:
RefreshPSD1Only = $true
DeleteTargetModuleBeforeBuild = $false
Those 2 would pretty much stop it from happening. However what I see now is missing, is that when ImagePlayground.psm1 has Development = $true it also requires one to build the libraries themselves
And it seems there's a bug that if i disable development it doesn't use the built files in the LIb folder anyways so clearly something is wrong and I need to fix the process as i've not used this for a while