RamblingCookieMonster / BuildHelpers

Helper functions for PowerShell CI/CD scenarios
MIT License
215 stars 47 forks source link

Changed the way `Set-ModuleFunctions` imports the target module #67

Closed lipkau closed 6 years ago

lipkau commented 6 years ago

By importing the target module in a new process (old way), modules with dependencies declared in the manifest where limited.

This change imports the module only into the scope of the function, therefore being able to import additional dependencies and having access to and setup (importing) done in the global scope

lipkau commented 6 years ago

I found that Import-Module -Scope Local does not work as expected.

Edit: Fixed

RamblingCookieMonster commented 6 years ago

I think I'm okay with this. Presumably you run your builds in a CI/CD pipeline or a new session, and thus it won't matter if loading a module and removing it pollutes things (e.g. exposes global variables or other global session or other external changes).

Will leave this open until Monday or Tuesday in case anyone has any concerns.

Thanks!

lipkau commented 6 years ago

I dismissed this PR for now, as appending the custom path to $env:PSModulePath does solve my problem.

thanks @markekraus