As a module author, I need to be able to specify where the build output should go.
Background
Because of how the using module statement works in PowerShell, I usually need to build output into the PSModule path without breaking the working versions -- however, by default the output should go in a folder in the project (let's call it "output" though, because plain English is good, and these aren't binaries).
Assumptions:
I have a source folder
That is, I have a project "root" folder. Within that I have a source folder with the build.psd1 file in it. It may be named "source" but it might also be named with the module name (e.g. "ModuleBuilder") or something else entirely. I might even have multiple modules within a single project. In that case, each one has it's own source folder (which obviously can't all be named "Source").
I sometimes want to add the version number
I can specify the module name in my build.psd1, but not the version, because that changes with each commit/build/release, but sometimes I want to build output into my PSModulePath, so it needs to be able to have the version number, so it doesn't "clean" the old versions out.
When building clean, we should clean this version
If we're adding version numbers to the build output path, we should leave any old version numbers. That way if we're building to the PSModulePath, we won't accidentally remove old versions that I might need for production work, or supporting users.
Proposal
We need a parameter -VersionedOutputDirectory that determines whether a version number is appended to the output folder path or not. This should be a switch that's used in addition to the -OutputDirectory parameter and can be defaulted in the build.psd1.
Possible results:
If you specify -VersionedOutputDirectory and no -OutputDirectory the output should go in a numbered subdirectory of the "root" folder.
If you specify -VersionedOutputDirectory and -OutputDirectory the output should go in a numbered subdirectory of the output directory.
If you specify a relative-OutputDirectory the output should go in a path relative to the build.psd1 (Currently, this is wrong)
As a module author, I need to be able to specify where the build output should go.
Background
Because of how the
using module
statement works in PowerShell, I usually need to build output into the PSModule path without breaking the working versions -- however, by default the output should go in a folder in the project (let's call it "output" though, because plain English is good, and these aren't binaries).Assumptions:
I have a source folder
That is, I have a project "root" folder. Within that I have a source folder with the
build.psd1
file in it. It may be named "source" but it might also be named with the module name (e.g. "ModuleBuilder") or something else entirely. I might even have multiple modules within a single project. In that case, each one has it's own source folder (which obviously can't all be named "Source").I sometimes want to add the version number
I can specify the module name in my build.psd1, but not the version, because that changes with each commit/build/release, but sometimes I want to build output into my PSModulePath, so it needs to be able to have the version number, so it doesn't "clean" the old versions out.
When building clean, we should clean this version
If we're adding version numbers to the build output path, we should leave any old version numbers. That way if we're building to the PSModulePath, we won't accidentally remove old versions that I might need for production work, or supporting users.
Proposal
We need a parameter
-VersionedOutputDirectory
that determines whether a version number is appended to the output folder path or not. This should be a switch that's used in addition to the-OutputDirectory
parameter and can be defaulted in thebuild.psd1
.Possible results:
-VersionedOutputDirectory
and no-OutputDirectory
the output should go in a numbered subdirectory of the "root" folder.-VersionedOutputDirectory
and-OutputDirectory
the output should go in a numbered subdirectory of the output directory.-OutputDirectory
the output should go in a path relative to the build.psd1 (Currently, this is wrong)