1.0.0 • Published 5 years ago

aws-sam-helper v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

aws-sam-helper

Helpers to build, test, package and deploy AWS Stateless Application Model projects under an opinionated directory structure. Description of the dir structure can be found here:

https://github.com/bingtimren/slush-aws-sam/blob/master/templates/default/docs/DirStructure.md

To create a new project under this dir structure, use Slush (https://slushjs.github.io/#/) and the aws-sam generator. See https://github.com/bingtimren/slush-aws-sam

Once a new project is created with the aws-sam generator, this tool is included in the project as a development dependency and will be used.

Environment

Testing requires AWS CLI, AWS SAM environment be ready. Credential must be created. AWS CLI profiles configured. Environment variable AWS_SDK_LOAD_CONFIG set to 'true'. Optionally set AWS_PROFILE to the profile to use.

export AWS_SDK_LOAD_CONFIG=true

Build

Complete build: npm run build Incremental compile: tsc -w

Test & Debug

Before testing, the AWS CLI environment must be ready. Credential must be created. During test, these AWS resources can be created (name may vary depending on the region, AWS CLI profile):

S3: cf-hello-world-for-test-safe-to-remove-default-ap-southeast-2 CloudFormation Stack: hello-world-for-test-safe-to-remove-default

To run all tests

npm run test

To run single test (match title) and check outputs

npx ava -m "create changeSet and deploy"

To debug

In VS Code, set breakpoint, open a test case (/src/lib/*.spec.ts), goto DEBUG and click "Debug Spec"