Skip to content

Latest commit

 

History

History
76 lines (45 loc) · 5.05 KB

template.md

File metadata and controls

76 lines (45 loc) · 5.05 KB

Deploy status Build status Docs generation status

CodeClimate


Repository initialization

When creating a repository from this template an init workflow (see here) will run. This workflow uses kaskadi-cli in order to properly initialize your repository by:

  • updating the names refering to the template in relevant files (for example package.json, package-lock.json, etc.) and renaming some files if need be
  • automatically adding your repository to Code Climate
  • automatically setting REPORTER_ID secret inside of your repository for test coverage upload to Code Climate. This may fail because of Code Climate infrastructure latency in setting up your repository. In such case your workflow will emit a warning telling you to set REPORTER_ID manually

Testing

mocha, chai, nyc & standard are available as dev dependencies.

A build workflow (see here) is running on pull request and will execute your test suite before allowing you to merge your PR. It also has a coverage job already prepared that you can comment out as soon as your testing is in place and your REPORTER_ID is in the repository secrets. This is the ID on Code Climate used for uploading code coverage reports.

Beside running your unit tests, this workflow runs a static code analysis to find any vulnerability in your code. If a vulnerability is found, a notification will appear in the Security tab of your repository.

The build workflow also runs a syntax-check job which checks your serverless.yml file syntax.


Documentation

This repository comes with a generate-docs workflow that generates documentation automatically for you by reading your main serverless.yml configuration file and extracting meta data of all layers you defined. See here and there for more information.

Before generating the documentation, the workflow will check for syntax error in your serverless.yml file.

If you would like to see the workflow configuration, head here.

You can configure the template used to generate the action documentation here.


Deploying

Deploying to AWS is done automatically via a deploy workflow (see here). This workflow will run on push. Before publishing it:

  1. performs a static code analysis of the layer to detect any vulnerabilities. If a vulnerability is found, a notification will appear in the Security tab of your repository
  2. checks the syntax of serverless.yml for any errors
  3. run any tests you may have set up with npm test

You'll have to switch the command from --version to deploy -v in the workflow configuration file to actually deploy!

Warning: you may need to manually deploy the first time via Serverless CLI locally.


{{>main}}


How to add dependencies to a layer?

  1. Go into layer/nodejs (layer being the path you defined in serverless.yml configuration file for your layer)
  2. Run npm i -S <package> to install any package you need for this layer

What if I would like to implement custom utilities?

You can use the folder called custom-utilities. This folder will be automatically copied into your layer when you run npm i. See here for details.

Note: you can rename this folder freely but beware to also update the postinstall script inside of your layer package.json file (see here).