Should Save-Script download all modules defined as dependencies or not?
Right now, when you run the Save-Script command you end up with a script and all its module dependencies. In my case, I only wanted a script and got 100+ MB of modules too. :(
It would be better if you introduce the -IncludeModules parameter, and by default only download a script with the Save-Script.
Downloading the modules with the script makes sense for Install-Script, but not so much with Save-Script, in my opinion.

5 comments
-
Joel "Jaykul" Bennett commented
This is not the same as #199 -- that's the installer, this is just "save."
I believe the suggestion here is that perhaps Save-Script should *default* to downloading *only* the script, and should have a switch like -Recurse to included dependencies. The assumption being made is that people using Save-Script are *not* using it to save the file for install elsewhere, but merely to allow inspecting it.
I'm curious about these two different use cases, and I think it's worth investigating which is most prevalent before deciding which behavior should be the default -- but I do think there regardless of the default, there needs to be a switch which provides the other behavior. Perhaps it's most logical to use the same `-SkipDependencyCheck` switch proposed for the installer.
-
Jianyun commented
We have discussion to this similar topic. Please see https://github.com/OneGet/oneget/issues/199.
-
As an FYI (not disagreeing with the feedback, just providing information) what this command does today is to always place all the required modules in the same path you save the script to. It won't install the modules, but does do a save, as per Save-Module.
Awaiting feedback from others on this item. -
Kirk Munro commented
Yeah, this cmdlet shouldn't just carbon-copy the Save-Module behaviour because the use case is different. My gut reaction to this is that it should (a) only download what modules you don't already have, and (b) prompt you first before downloading them, with a way to get all/get just the script without prompting using parameters. Having it download modules that you already have is wrong. Having it download modules you don't have without an option to not download those is wrong. Why would you bother download a binary module, which in the case of Azure may be part of a sizeable package, when you just want to take a closer look at a script?
-
Joel "Jaykul" Bennett commented
I totally agree that it makes sense there should be an *option* to not also download all the modules. There's a good chance I already have them anyway, or will be deploying to somewhere where they're already installed.