Git Product home page Git Product logo

typescript-serverless's Introduction

typescript-serverless

Base template for serverless framework with typescript, eslint and jest preconfigured

This repository comes pre-configured with some common tools and configuration for working serverless frameowrk and Typescript with AWS.

A full breakdown of this setup can be found here

Serverless Plugins

  • serverless-iam-roles-per-function
  • serverless-create-global-dynamodb-table
  • serverless-offline

Lambda PowerTools

  • @dazn/lambda-powertools-cloudwatchevents-client
  • @dazn/lambda-powertools-correlation-ids
  • @dazn/lambda-powertools-logger
  • @dazn/lambda-powertools-pattern-basic
  • @dazn/lambda-powertools-lambda-client
  • @dazn/lambda-powertools-sns-client
  • @dazn/lambda-powertools-sqs-client
  • @dazn/lambda-powertools-dynamodb-client
  • @dazn/lambda-powertools-kinesis-client

Linting

  • eslint
  • eslint-config-airbnb-base
  • typescript-eslint
  • eslint-plugin-import
  • @typescript-eslint/eslint-plugin
  • @typescript/eslint-parser
  • eslint-import-resolver-alias
  • eslint-plugin-module-resolver

Testing

  • jest
  • babel-jest
  • @babel/core
  • @babel/preset-env
  • @babel/preset-typescript

A default test is included to verify that jest is configured correctly

describe('who tests the tests?', () => {
  it('can run a test', () => {
    expect.hasAssertions();
    expect(1).toBe(1);
  });
});

Module Aliasing

Everything comes configured out the box to leverage module aliasing. 3 example aliases have been preconfigured.

Aliases must be defined in webpack, tsconfig, and eslint

webpack:

resolve: {
  extensions: ['.mjs', '.json', '.ts'],
  symlinks: false,
  cacheWithContext: false,
  alias: {
    '@src': path.resolve(__dirname, './src'),
    '@queries': path.resolve(__dirname, './queries'),
    '@tests': path.resolve(__dirname, './tests'),
  },
},

tsconfig:

"paths": {
  "@src/*": ["src/*"],
  "@queries/*": ["queries/*"],
  "@tests/*": ["tests/*"]
}

eslint:

"settings": {
  "import/resolver": {
    "alias": {
      "map": [
        ["@src", "./src"],
        ["@tests", "./tests"],
        ["@queries", "./queries"]
      ],
      "extensions": [
        ".ts",
        ".js"
      ]
    }
  }
}

typescript-serverless's People

Contributors

mtimbs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.