Does Pulumi have an easy way to turn TS code into ...
# typescript
b
Does Pulumi have an easy way to turn TS code into JS before passing it to a Cloudflare Worker?
l
That's not generally a Pulumi problem. That's a job for tsc or your preferred Typescript transpiler.
b
It's annoying to do the extra step manually or in CI.
All I want is a
NodejsFunction
equivalent from CDK.
l
Is this for deploying code to a remote runner? You have lambda-esque code that you want to transpile during deployment?
b
When you use wrangler and call
wrangler deploy
, it automatically does the transpilation and bundling.
But with Terraform (and thus Pulumi), you have to do it manually and then pass the output js file to the resource.
That just sucks.
l
Is this for deploying code to a remote runner? You have lambda-esque code that you want to transpile during deployment?
b
ofc you deploy to a remote worker
l
Sorry, I'm not being clear enough. Is this code that you want transpiled so that it can be run in the cloud, or is it Pulumi program code?
b
I used this provider in the past, but I think Pulumi should solve this issue theirselves.
It is the function code
l
Ok.
b
I know Pulumi has a Function Serializition thing for inline I think.
l
Then you should not try to do this during deployment. Just as you would not compile your C# or Java code during deployment. It may be possible, but you should not do it.
b
But that's mainly AWS stuff.
l
It does, and you should not use it. Just like you should not build your Docker image during deployment
Pulumi does allow this, and it's always breaks stuff for people.
b
What you are saying is nonsense. That's how CDK works. You run deploy and it uses esbuild behind the scene to do the job for you.
l
App-building and infra-deploying are very different, and should be strictly kept apart
From years of experience, it is always worse when you try this.
b
Yeah sure, I've been using it for 5 years and no issues.
l
Ok.
b
Well I guess I can still use the Terraform provider to run esbuild. I hoped for a cleaner way tho.
Or need to use SST that uses Pulumi behind the scenes and handles the bundling for you.
It's dumb that you need a Pulumi wrapper to do the most basic stuff.
e
If all that TF provider is doing is calling esbuild you could probably just use the pulumi command provider instead, it will .tar up an output folder for you if needed: https://www.pulumi.com/registry/packages/command/api-docs/local/command/#archivepaths_nodejs