You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Skip invocation of hooks and unzip / delete commands if no hooks are registered (#259)
Thanks for creating this construct - it makes working with .NET Lambda
functions in CDK a much better experience!
Out of curiosity I have been reading through the code base to learn more
about how this construct has been implemented, and I noticed a minor
optimization that can be done.
The construct was already (implicitly) using `AUTO_DISCOVER` as bundling
output type, which according to the docs means:
> If the bundling output directory contains a single archive file (zip
or jar) it will be used as the bundle output as-is. Otherwise, all the
files in the bundling output directory will be zipped.
This also means that if no hooks are registered, then there is a such no
need to go through the work of unzipping the produced `package.zip`
file, just for the CDK to zip it again.
This PR introduces a simple check, to see if hooks are registered, and
if not, the produced command is simply just the `dotnetPackageCommand`
which spits out a `package.zip`, which, due to the use of
`AUTO_DISCOVER` as bundling output type, is then picked up and use as
code asset by the CDK.
On top of this, while the bundling output type in CDK does default to
`AUTO_DISCOVER`, I have now configured it in code, just to make it
explicit that the this "auto mode" is in fact used as part of the
construct's logic.
0 commit comments