Skip to content

AWS Lambda development skeleton. TypeScript, TDD, Lint, WP, Bundle Analysing, Code Coverage, DI.

Notifications You must be signed in to change notification settings

KarmalitaD/ts-wp-lambda-skeleton

Repository files navigation

AWS lambda skeleton

Features

  • TDD (mocha, chai)
  • Webpack
  • Webpack Bundle Analyzer
  • SonarQube compatible code coverage calculation
  • TypeScript linting (AirBnb code style based)
  • DI

How to use

git clone https://gitlab.com/Hojyman/ts-wp-lambda-skeleton.git
cd ts-wp-lambda-skeleton
npm ci

# Now use one of the npm scripts listed in the next section

npm scripts

dev - run TDD development (watch mode)

test:coverage - calculate test coverage (with lcov and html reports)

build - build the production bundle

build:analyze - build production bundle with the analyzing report

tslint - linting the code

tsfix - fixing the code style when possible

Code example

The lambda code has two major parts:

  • main.ts - exports lambda factory. It should take all of the dependencies necessary to inject. This factory can be imported directly from tests and used to inject any mocks we need.

  • index.ts - the main entry point used by webpack for production bundle generation. It takes the lambda factory from the main file, injects all necessary dependencies, and exports the ready-to-deploy handler.

References

About

AWS Lambda development skeleton. TypeScript, TDD, Lint, WP, Bundle Analysing, Code Coverage, DI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published