Simple boilerplate for a simple NodeJS lambda function. Includes package script and CircleCI config.
- Requires Node v6.10
- Package engine is set to strict to match AWS Lambda Environment
- I recommend using NVM
This project includes Mocha and Chai. If you add to this, write more tests. And run them:
$ npm test
The lint config is based on AirBnB's eslint. To lint the code run:
$ npm run lint
Make sure the bin directory has executable permissions:
$ chmod +x ./bin/build.sh
If this throws an error, trying using sudo:
$ sudo chmod +x .bin/build.sh
Zip up source code and runtime dependencies by running:
$ npm run build
This should output files.zip to the project root for upload to the AWS Lambda Console.
Included is a circle.yml file for deployment to AWS with CircleCI.
This will:
- Run mocha tests.
- Publish a coverage report with coveralls.
- Publish a dependency status report with david.
- Deploy your code to AWS when master or develop is updated on github.
In order to deploy :
- configure AWS Permissions for your Circle CI account.
- Setup coveralls for your repo.
- Set the following environment vars in your Circle CI build console:
- COVERALLS_REPO_TOKEN - access token for coveralls, used to publish a coverage report.
- PROD_FUNCTION_NAME - the name of the AWS Lambda you want to build when
masteris pushed to github. - DEV_FUNCTION_NAME - (optional) the name of the AWS Lambda you want to build when
developis pushed to github.
- Be sure to replace references to
node-lambda-boilerplatein the badges at the top of this README with the name of your repo.