From cac045262c84cd9b228465dfc1f94ea6c35c9780 Mon Sep 17 00:00:00 2001 From: Nicolas Froidure Date: Fri, 27 Mar 2020 18:38:18 +0100 Subject: [PATCH] docs(@whook/aws-lambda): improve the readme --- packages/whook-aws-lambda/README.md | 8 ++++++++ packages/whook-aws-lambda/src/index.ts | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/whook-aws-lambda/README.md b/packages/whook-aws-lambda/README.md index 48ee1db6..bc2e0d3a 100644 --- a/packages/whook-aws-lambda/README.md +++ b/packages/whook-aws-lambda/README.md @@ -99,6 +99,14 @@ You can easily test your lambda builds by adding `@whook/aws-lambda` npm run whook -- testHTTPLambda --name getPing ``` +## Deployment + +We recommend using [Terraform](https://terraform.io) to deploy your + lambda functions. + +There is a complete example on how to deploy your lambdas + [in this pull request](https://github.com/nfroidure/whook/pull/54). + [//]: # (::contents:end) # API diff --git a/packages/whook-aws-lambda/src/index.ts b/packages/whook-aws-lambda/src/index.ts index e539e2ea..ea6f032f 100644 --- a/packages/whook-aws-lambda/src/index.ts +++ b/packages/whook-aws-lambda/src/index.ts @@ -337,7 +337,7 @@ async function buildFinalLambda( await Promise.all([ ensureFileAsync({ log }, `${lambdaPath}/index.js`, contents, 'utf-8'), mappings - ? await ensureFileAsync( + ? ensureFileAsync( { log }, `${lambdaPath}/index.js.map`, mappings, @@ -402,10 +402,10 @@ async function ensureFileAsync( } } catch (err) { log('debug', 'Write new file:', path); - return writeFileAsync(path, content, encoding); + return await writeFileAsync(path, content, encoding); } log('debug', 'Write changed file:', path); - return writeFileAsync(path, content, encoding); + return await writeFileAsync(path, content, encoding); } // Cannot promisify mkdirp easily so doing it by hand