Giter Club home page Giter Club logo

envek / cookiecutter-aws-sam-typescript-layers Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 5.0 16 KB

AWS SAM template to quickly set up Lambda application using TypeScript on Node.js 14 with shared layers for dependencies

Home Page: https://evilmartians.com/chronicles/serverless-typescript-a-complete-setup-for-aws-sam-lambda

License: MIT License

Makefile 25.76% TypeScript 64.74% JavaScript 9.50%
typescript aws-sam lambda-layer cookiecutter aws-lambda aws-lambda-node

cookiecutter-aws-sam-typescript-layers's Introduction

Template for AWS SAM using TypeScript and shared layers

This is a Cookiecutter template to create a Serverless application based on Serverless Application Model (SAM) on Node.js 14 runtime using TypeScript for Lambda functions source code and shared layers for runtime dependencies.

Resulted application will be close to this example app: aws-sam-typescript-layers-example

Usage

Install AWS SAM CLI and run following command:

sam init --location gh:Envek/cookiecutter-aws-sam-typescript-layers

You'll be prompted a few questions to help this template to scaffold this project and after its completion you should see a new folder at your current path with the name of the project you gave as input.

License

This project is licensed under the terms of the MIT license.

cookiecutter-aws-sam-typescript-layers's People

Contributors

envek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cookiecutter-aws-sam-typescript-layers's Issues

How to handle outside src dependencies

Hello guys, thank you for this nice project. Honestly, after days researching, this was simply the best option to build lambdas with layers using SAM.
This makefile trick WOW it's amazing.

I was wondering if it's possible to to use dependencies that are located outside src folder.
Let me explain this scenario ๐Ÿ‘‡โ€

project
  |_ src
  |_ layers
  |_ package.json
  |_ tsconfig.json

Well, I have some utils where I'm placing inside this layer. The tsconfig.json has this path setup:

"paths": {
     "/opt/nodejs/defaultResponses": ["layers/utils/src/defaultResponses"]
 }

I'm importing these as follow:

import defaultResponses from '/opt/nodejs/defaultResponses'

I'm getting:

'rootDir' is expected to contain all source files

If I change tsconfig.json rootDir to

"rootDir": "."

I get this working but compiled dist folder is as follow

project
  |_dist
    |_ layers
    |_ src

I know it's not an issue of this repo but as I'm quite new to typescript, do you guys can suggest some solutions for this?

If I move things around in makefile I'm not benefited anymore by the watch script because the compiled dist folder is not compatible with template codeuri.

I really appreciate a suggestion ๐Ÿ˜€

Thank you very much.

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.