1.0.4 • Published 7 years ago
@jahed/aws-lambda-package v1.0.4
@jahed/aws-lambda-package
Packages your NodeJS code to be executed on AWS Lambda.
Installation
yarn add -D @jahed/aws-lambda-packageWorkspaces
If you're using workspaces, install it at the root package.
yarn add -W -D @jahed/aws-lambda-packageUsage
Building Single Packages
Running aws-lambda-package will do the following:
- Run
yarn packto create atgzsimilar toyarn publish - Extract the
tgzto a temporary directory - Run
yarn install --productionon the directory - Create a ZIP of the directory's contents on your current working directory.
- You will have to upload your ZIP to AWS Lambda or S3 manually (or using your own script)
yarn aws-lambda-packageIf you're using workspaces and just want to build one workspace, you can do the following:
yarn workspaces your-package-name aws-lambda-packageBuilding all your workspaces
You can build all of your workspaces at once by running aws-lambda-workspaces
at the root package.
yarn aws-lambda-workspacesCaveats
- To ensure full compatibility, you may need to run
aws-lambda-packagein an environment similar to AWS Lambda. Try outdocker-lambdaif you run into this issue.
Reasoning
A lot of ZIP tools assume Windows line separators (\) are okay. AWS Lambda
however doesn't support these separators. So I made this project to work
across systems and remove as many caveats as possible.