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
Hi - I'm trying to build a construct similar to NodeJSFunction. We are using webpack with swc rather than esbuild, so we're taking the implementation as a reference rather than using the existing construct directly.
I notice that there's a this.command = ['bash', '-c', bundlingCommand]part, which is eventually passed to spawnSync. Does this mean that if we have to do bundling/preparation which is async (promises, callbacks etc.), we always need to create a subprocess to un-asyncify it? Are there any plans to allow declaring "hooks" which can run asynchronously, in process, similar to serverless framework? Or are we thinking about this the wrong way?
When these resources are created, there could be a part of cdk deploy/cdk synth that runs the build() function for any BuildTask instances under scope, before trying to synthesize or deploy anything.
As a follow-up it could maybe take hashable inputs to tell it when it's safe to skip the build() task, which might be slow.
This could be used for bundling, or fetching deploy-time assets from a remote server, or all sorts of things.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi - I'm trying to build a construct similar to
NodeJSFunction
. We are using webpack with swc rather than esbuild, so we're taking the implementation as a reference rather than using the existing construct directly.I notice that there's a
this.command = ['bash', '-c', bundlingCommand]
part, which is eventually passed tospawnSync
. Does this mean that if we have to do bundling/preparation which is async (promises, callbacks etc.), we always need to create a subprocess to un-asyncify it? Are there any plans to allow declaring "hooks" which can run asynchronously, in process, similar to serverless framework? Or are we thinking about this the wrong way?I could imagine an API something like this:
When these resources are created, there could be a part of
cdk deploy
/cdk synth
that runs thebuild()
function for anyBuildTask
instances underscope
, before trying to synthesize or deploy anything.As a follow-up it could maybe take hashable inputs to tell it when it's safe to skip the
build()
task, which might be slow.This could be used for bundling, or fetching deploy-time assets from a remote server, or all sorts of things.
Beta Was this translation helpful? Give feedback.
All reactions