aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 78 forks source link

Add support for multiple PowerShell script files. #175

Closed aetos382 closed 2 years ago

aetos382 commented 3 years ago

Describe the Feature

To use the New-AWSPowerShellLambdaPackage command, I must either generate the package from a single ps1 file (-ScriptFile parameter) or create a C# project to run the PowerShell script (-ProjectDirectory parameter).

I want to split some of the code of function into another file and package it along with the main script file. However, I don't want to write my C# project.

Please provide a new option for the New-AWSPowerShellLambdaPackage command that only requires multiple ps1 files and packages them.

Is your Feature Request related to a problem?

Separating common code for multiple functions into an external file improves code maintainability.

Proposed Solution

Add a new parameter set to the New-AWSPowerShellLambdaPackage command. To load all the files and then start executing, I need to specify an entry point.

For example:

New-AWSPowerShellLambdaPackage -ScriptFiles <string[]> -EntryPoint <string>

Describe alternatives you've considered

I can accomplish my goal by combining the common code into a separate PowerShell module and loading it with #Requires -Module. However, #Requires -Module cannot specify a path relative to the main script file, so the module must be in a directory registered in the PSModulePath environment variable. This is inconvenient for source control.

Additional Context

Environment


This is a :rocket: Feature Request

github-actions[bot] commented 2 years ago

We have noticed this issue has not recieved attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.