PoshCode / ModuleBuilder

A PowerShell Module to help scripters write, version, sign, package, and publish.
MIT License
445 stars 54 forks source link

Adding an option to Build-Module for sorting source files #119

Closed gaelcolas closed 1 year ago

gaelcolas commented 1 year ago

fixes #118 This is the flexible approach so we can have more customized sorting mechanism.

The alternative is that we mandate the sorting by always adding | Sort-Object -Property 'FullName' to the Get-ChildItem.

TBH, I prefer the latter since:

  1. the perf impact will be minimum anyway
  2. there's no need to change how we call Build-Module,
  3. It's the same behaviour for NTFS file systems...

but it's also a bit more risky as it changes the code path, and is less flexible (although, we may not need to be too clever anyway). Let me know and I can amend the PR with your suggestion. I'd love to get that sorted and published "soon", so my build can be fixed (and finally OSS'ed..). Thanks, Gael

Jaykul commented 1 year ago

I'm OK merging it the way you've written it -- that's guaranteed not to have any side effects, but I agree with your points -- it seems to me that putting the sort in (although it will have a tiny performance impact) is safe enough.

As you say, it won't really change the outcome except in this edge case where the outcome is unexpectedly unpredictable and breaks things.

gaelcolas commented 1 year ago

I'll favour #120 as it keeps the change simpler and doesn't affect the UX. If needed we can fall back to this more complex approach.