From ff6c6ca408c12dc4a77acd28e39e2f49ebd15b39 Mon Sep 17 00:00:00 2001 From: Thorsten Hoeger Date: Fri, 21 May 2021 00:45:06 +0200 Subject: [PATCH] fix: create lambda folder on demand --- src/constructs/webhook.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/constructs/webhook.ts b/src/constructs/webhook.ts index 1a7c2e8..8fcd606 100644 --- a/src/constructs/webhook.ts +++ b/src/constructs/webhook.ts @@ -73,10 +73,10 @@ export class HttpWebhook extends cdk.Construct { private createHandler() { const description = `Webhook ${this.props.name}`; - const entryFile = `./src/lambda/webhook.${this.props.name.replace(/[^\w-]/g, '-')}.ts`; + const entryFile = `./src/lambda/webhook.${this.props.name.toLowerCase().replace(/[^\w-]/g, '-')}.ts`; if (!fs.existsSync(entryFile)) { + fs.mkdirSync('./src/lambda', { recursive: true }); fs.writeFileSync(entryFile, `import { http, errors } from '@taimos/lambda-toolbox'; -import { operations } from './types.generated'; export const handler = http.createHttpHandler(async (ctx) => { ctx.logger.info(JSON.stringify(ctx.event));