RamblingCookieMonster / PSDepend

PowerShell Dependency Handler
MIT License
285 stars 76 forks source link

Allow Per-DependencyType default options #42

Open RamblingCookieMonster opened 7 years ago

RamblingCookieMonster commented 7 years ago

We currently support PSDependOptions, which specifies global values that apply to all dependencies (unless overridden in individual dependencies).

It might be helpful to add a third layer between these (overrides global, overridden by individual dependencies) for per-dependencytype defaults

Thought someone had mentioned this in an issue, can't seem to find it.

Haven't thought through syntax yet, just getting the idea out there. Off the top of my head without considering existing design or repurcussions, maybe just add keys under PSDependOptions where the key is the dependency type name?

Cheers!

michaeltlombardi commented 7 years ago

So, would an example of this be for repositories? The default for the npm type would be.... npm.... but I could override to my own artifactory?

RamblingCookieMonster commented 7 years ago

Yep! Basically... if you have a few different dependency types, and a parameter you want to globally set just for one dependency type, it would be nice to have a middle ground (as is, you can set on each definition or globally - globally will actually work IIRC, just spits out a warning, and if parameters ever share a name with different intent, could be bad).

Similar to your example, PSGalleryNuget has a Source - other dependency types also use Source, with what likely won't be shared across differing dependency types (assuming they aren't nuget based)

So right now, I could set the Source to some nuget URI... but what if I also have a few Package types in there, and also want those to have a re-usable (specific to the Package type) Source?

Plenty of ways to work around it for now, figured at some point it might come in handy though : ) Not on my radar for a while (or until I get bored!)

michaeltlombardi commented 7 years ago

I think dependency type defaults / overrides is a great idea.