A good start for an AWS Lambda function. If you combine this with the aws-lambda-autodeploy-lambda you will have a very fast deployment process. When you push code to Github.com it will only take a couple of minutes to run all your test, deploy you code to S3 and refresh the Lambda function. All automatic while you're drinking a fresh cup of newly brewed coffee.
Features:
- Boilerplate for AWS Lamda functions.
- Automated unit tests with NPM and Jest.
- Code coverage with Jest.
- Code style and hits with ESLint.
- CI integration with Travis.
- And last but not least; deployment with AWS CloudFormation
$ git clone
$ npm install
$ cp ./bin/set-env-dist.sh ./bin/set-env.sh
$ . ./bin/set-env.sh
$ npm run test:watch
$ npm test
$ npm run lint
$ npm run build
$ npm run coverage
$ bash ./changelog.sh
To get auto coveralls reporting working you need to add your encrypted Coveralls token in .travis.yml
.
This is how you do it:
$ travis encrypt COVERALLS_REPO_TOKEN=<super_secret coveralls token> --add env.global
- Connect your Github.com repo to your Travis CI account. https://travis-ci.org/
- Add
AWS_ACCESS_KEY
andAWS_SECRET_KEY
to your Travis CI environment. - Edit
.travis.yml
to match yourbucket
,upload-dir
andregion
. - Copy
.coveralls-dist.yml
to.coveralls.yml
and add you secret key.
Next time you push to your master brach Travis will run your tests and if all is green report coverage to Coveralls.
Isn't this great? :D
# To create a new stack:
$ bash ./bin/create-stack.sh
# To update a current stack:
$ bash ./bin/create-stack.sh -u
# Install Node Security Platform CLI
$ npm install nsp --global
# From inside your project directory
$ nsp check
$ npm install -g npm-check-updates
$ ncu -u
$ npm install --save --no-optional