https://github.com/oieduardorabelo/aws-sam-typescript-shared-package-json
AWS SAM TypeScript example using a single package.json to all lambda handlers
https://github.com/oieduardorabelo/aws-sam-typescript-shared-package-json
amazon-api-gateway aws aws-lambda aws-sam aws-sam-cli aws-sam-example aws-sam-nested-applications serverless typescript
Last synced: 13 days ago
JSON representation
AWS SAM TypeScript example using a single package.json to all lambda handlers
- Host: GitHub
- URL: https://github.com/oieduardorabelo/aws-sam-typescript-shared-package-json
- Owner: oieduardorabelo
- Created: 2023-03-08T04:49:39.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T04:55:02.000Z (almost 2 years ago)
- Last Synced: 2025-01-13T14:24:37.204Z (about 1 month ago)
- Topics: amazon-api-gateway, aws, aws-lambda, aws-sam, aws-sam-cli, aws-sam-example, aws-sam-nested-applications, serverless, typescript
- Language: TypeScript
- Homepage:
- Size: 82 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AWS SAM TypeScript example using a single package.json to all lambda handlers
Based on GitHub Issue: https://github.com/aws/aws-sam-cli/issues/4832
This repository is an example of how to use a single `package.json` to manage all lambda handlers.
## How it works
Setting `CodeUri` to root folder (`./`) of the stack might cause other issues with other commands. The suggestion is to still point `CodeUri` to a folder with a `package.json` file.
Because of that, we need 2 `package.json` file:
- **./package.json:** Used to install development dependencies like lint, test and utilities for the management of the project.
- **./functions/package.json:** Used to install production dependencies for each lambda handler (e.g. aws-sdk, npm modules used by the lambda handler).Using this approach, we need to run `npm install` in two places. One for the root folder and another for the `functions` folder.