JustinGrote / ModuleFast

A "fast and loose" way to install modules from Powershell Gallery quickly. Meant for CICD, not production
Other
74 stars 5 forks source link

AnyPackage Provider #75

Open ThomasNieto opened 6 months ago

ThomasNieto commented 6 months ago

A ModuleFast AnyPackage provider has been published. Give it a shot and let me know if you run into any issues: https://www.powershellgallery.com/packages/AnyPackage.ModuleFast

JustinGrote commented 6 months ago

Awesome! When I get done with the next release and Github Action I'll try it out and make sure it is compatible. You're the best!

JustinGrote commented 6 months ago

@ThomasNieto Looks pretty good! Some thoughts:

  1. You could use Install-ModuleFast -Plan to provide a package get/find operator
  2. If multiple packages are specified to install together (e.g. -name 'package1','package2', they should all be provided together to modulefast both for efficient and for dependency resolution, as well as not getting 500 Install-Package prompts.
  3. It currently reports Package Not Found if a package is already installed. On my todo is to fix both -Plan and -PassThru to include modules that were part of the plan but already installed, once I fix that it will probably report more "correctly". Tracked in https://github.com/JustinGrote/ModuleFast/issues/80
ThomasNieto commented 6 months ago

@JustinGrote

  1. I like the idea of adding Find operator to support the Plan parameter.
  2. Did the prompt come from AnyPackage or ModuleFast? Also what was the $ConfirmPreference set to or was Confirm parameter passed? The problem is that the provider interface only handles one package at a time via PackageRequest to property cycle through each provider if a package isn't found. The provider interface does support handling ShouldProcess calls so that if the user says Yes to All it would work for all packages and providers. That was a common problem in OneGet where it would keep prompting. I have also thought of adding a PromptDependencies for providers to indicates this package would also include X dependencies. Then the user would be able to say Yes to All for all package dependencies for as many packages or providers called in a single invoke. I do something similar with PromptUntrustedSource where if an untrusted source is called multiple times if Yes to All or No to All is honored. If you have any ideas I'd be welcome to hear them.
  3. That would work
ThomasNieto commented 6 months ago

Find-Package support was added in the latest release (v0.1.2)