https://pulumi.com logo
#typescript
Title
# typescript
s

square-rocket-59657

01/30/2020, 8:14 AM
Has anyone created a Lambda Layer with a typescript class? For example say i have a seperate class i've created that i want to be reused across multiple lambdas something like:
Copy code
class myAwesomeClass {
  ... cool options here
}
awesome.ts
Then when creating my layer referencing it like:
Copy code
const awesomeLayer = () => new aws.lambda.LayerVersion('my-lambda-version', 
{
  code: new pulumi.asset.AssetArchive({
    '.': new pulumi.asset.FileArchive('./awesome.ts'),
  }),
  compatibleRuntimes: [
    aws.lambda.NodeJS12dXRuntime,
    aws.lambda.NodeJS10dXRuntime,
  ],
  layerName: 'awesome_layer'
}, providerOpts);
The issue it that obviously the typescript file wont run in the lambda, is there a way that pulumi can compile this to normal JS? Or have i missed something?
c

clever-egg-2543

01/30/2020, 7:48 PM
You’ll need to “build” your awsomeness using
tsc
first. Then use the build path, usually
bin
or
dist
to reference the js file.
👍 1
s

square-rocket-59657

01/31/2020, 1:47 AM
Is there not a way that pulumi can do it using the built in typescript support?
c

clever-egg-2543

01/31/2020, 4:36 AM
No,
Pulumi
is a runtime, not a compiler, afaik.