psake / PowerShellBuild

Common build tasks for psake and Invoke-Build that build and test PowerShell modules
MIT License
133 stars 24 forks source link

Dependency on variable in parent scope (Build-PSBuildUpdatableHelp) #54

Closed IMJLA closed 1 year ago

IMJLA commented 2 years ago

Expected Behavior

The following command should successfully complete its call to New-ExternalHelpCab:

Build-PSBuildUpdatableHelp -DocsPath 'C:\Temp\docs' -OutputPath 'C:\Temp\dist\UpdatableHelp'

Current Behavior

Currently an error is thrown if the $ModuleName variable is not correctly defined in the parent scope:

 New-ExternalHelpCab: untitled:Untitled-2:49:29
Line |
  49 |          New-ExternalHelpCab @cabParams > $null
     |                              ~~~~~~~~~~
     | Cannot validate argument on parameter 'LandingPagePath'. Path 'C:\Temp\docs/en-US/.md' is not a file.

Possible Solution

This can be addressed by adding a Module parameter that defaults to the value of the $ModuleName variable

Steps to Reproduce (for bugs)

  1. Launch pwsh
  2. Run this command:
Build-PSBuildUpdatableHelp -DocsPath 'C:\Temp\docs' -OutputPath 'C:\Temp\dist\UpdatableHelp'

Context

This will make it easier to use Build-PSBuildUpdatableHelp in custom psake tasks

Your Environment

Name Value


PSVersion 7.2.1 PSEdition Core GitCommitId 7.2.1 OS Microsoft Windows 10.0.19044 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0