0.3.2 • Published 4 years ago

lambda-zip v0.3.2

Weekly downloads
382
License
Apache-2.0
Repository
github
Last release
4 years ago

It was mainly designed to help deploy nodejs packages in AWS lambdas.

When deploying nodejs codes to AWS lambda, all dependent modules needed to be included. But if you simply zip all content node_modules/ folder, the final media may be messed up with some dev dependencies. So to exclude the dev dependencies, initially I found node-pack-zip , but @jogoussard found this repo did not support transitive dependencies (see issue#2). and then he forked and created node-repack-zip.

As the .packignore config file in original design only did files exclusion, but in my case, I only need to specify which files should be included. So I modified node-repack-zip repo, and created a new one. You should explicicly specify the files you want to include in the config files.

Installation

npm install --save-dev lambda-zip

Example

my-lambda is an npm package I want to run as an AWS Lambda Function.

Install lambda-zip locally in my-lambda

npm install --save-dev lambda-zip

Install any runtime dependencies of my-lambda.

npm install

Add a config file in the root of my-lambda, let's say .dev

Modify my-lambda/package.json:

"scripts": {
    "build-aws-lambda": "lambda-zip .dev lambda.zip"
    ...
}

Create the lambda.zip file containing my-lambda and all its dependencies, ready to be uploaded to AWS Lambda

npm run build-aws-lambda

Release notes

0.3.1 - remove .packignore file, and all files are not included by default. 0.2.5 - Added support for root module _phantomChildren dependencies. 0.2.4 - Initial published release

0.3.2

4 years ago

0.3.1

5 years ago

0.3.0

5 years ago