@jcoreio/toolchain-aws-lambda 4.3.0 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @jcoreio/toolchain-aws-lambda
2
+
3
+ This project deploys an AWS Lambda Function from JS or TS source.
4
+
5
+ ## Features
6
+
7
+ - Supports `.env` file, you can put AWS credentials, `AWS_SDK_LOAD_CONFIG=1`, `AWS_REGION` etc in `.env` if you like
8
+ - Adds the `tc deploy` script, which deploys to AWS
9
+ - Uses `pack-lambda` to stream the source to S3, supporting `pnpm`
10
+ - If you use `@jcoreio/toolchain-semantic-release`, will deploy in CI
11
+
12
+ ## Conventions
13
+
14
+ The project must contain `scripts/cloudFormationTemplate.js` (or `.ts` if you're using `@jcoreio/toolchain-typescript`)
15
+ that exports the following:
16
+
17
+ - `StackName` (optional) - the name for the CloudFormation Stack (defaults to the Lambda FunctionName)
18
+ - `Template` - the CloudFormation template
19
+ - `Parameters` (optional) - the parameters for the template
20
+ - `Capabilities` - the capabilities to use when deploying the stack
21
+ - `Tags` (options) - the tags for the CloudFormation Stack
22
+
23
+ The `Template` must contain one `AWS::Lambda::Function` or `AWS::Serverless::Function`. It will provide defaults
24
+ for the following properties, so they are optional:
25
+
26
+ - `Description`: defaults to the `description` in `package.json`
27
+ - `CodeUri`: defaults the `Bucket` to the AWS Account, and the
28
+ `Key` to something based upon the `name` in `package.json`
29
+ - `Handler`: defaults to the `handler` export in the `main` file
30
+ in `package.json`
31
+ - `Runtime`: defaults to `nodejs20.x`
32
+ - `FunctionName`: defaults to something based upon the `name` in `package.json`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain-aws-lambda",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "AWS Lambda function build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "dotenv": "^16.4.5",
24
24
  "resolve-bin": "^1.0.0",
25
25
  "zod": "^3.21.4",
26
- "@jcoreio/toolchain": "4.3.0"
26
+ "@jcoreio/toolchain": "4.3.2"
27
27
  },
28
28
  "toolchainManaged": {
29
29
  "devDependencies": {
@@ -1,5 +1,5 @@
1
1
  const dedent = require('dedent-js')
2
- const { toolchainPackages } = require('../util/findUps.cjs')
2
+ const { toolchainPackages } = require('@jcoreio/toolchain/util/findUps.cjs')
3
3
 
4
4
  module.exports = [
5
5
  async function getConfigFiles() {
@@ -3,12 +3,8 @@ const {
3
3
  toolchainPackages,
4
4
  } = require('@jcoreio/toolchain/util/findUps.cjs')
5
5
  const fs = require('@jcoreio/toolchain/util/projectFs.cjs')
6
- const { uploadToS3 } = require('@jcoreio/pack-lambda')
7
6
  const path = require('path')
8
7
  const { inspect } = require('util')
9
- const { S3Client, CreateBucketCommand } = require('@aws-sdk/client-s3')
10
- const { STSClient, GetCallerIdentityCommand } = require('@aws-sdk/client-sts')
11
- const { deployCloudFormationStack } = require('@jcoreio/cloudformation-tools')
12
8
  const z = require('zod').default
13
9
 
14
10
  const TemplateModuleSchema = z.strictObject({
@@ -52,6 +48,11 @@ module.exports = async function deploy() {
52
48
  const packageJson = await fs.readJson(packageJsonFile)
53
49
  require('dotenv').config()
54
50
 
51
+ const { uploadToS3 } = require('@jcoreio/pack-lambda')
52
+ const { S3Client, CreateBucketCommand } = require('@aws-sdk/client-s3')
53
+ const { STSClient, GetCallerIdentityCommand } = require('@aws-sdk/client-sts')
54
+ const { deployCloudFormationStack } = require('@jcoreio/cloudformation-tools')
55
+
55
56
  if (toolchainPackages.includes('@jcoreio/toolchain-esnext')) {
56
57
  // eslint-disable-next-line @jcoreio/implicit-dependencies/no-implicit
57
58
  require(require.resolve(