1.0.2 • Published 7 months ago
@abfry0620/lambda-package v1.0.2
lambda-package
A CLI tool for compiling and packaging AWS Lambda functions created in TypeScript into ZIP files.
Installation
Simply run it using npx
:
npx @abfry0620/lambda-package
# Or install globally if you prefer
npm install -g @abfry0620/lambda-package
Usage
Display Help
npx @abfry0620/lambda-package --help
Example output:
Usage: lambda-package [options]
Compile and Zip programs created in TypeScript for AWS Lambda.
Options:
-V, --version output the version number
-h, --help display help for command
Display Version
npx @abfry0620/lambda-package --version
Process Flow
When you run the tool, it performs the following steps:
- Clean up existing
dist
directory andpackages
directory - Compile TypeScript code (
npm run build
) - Install production dependencies only
- Package compiled code and dependencies into a ZIP file
- Restore development dependencies
Configuration
By default, it works with the following settings:
distDir
: 'dist' - Directory where compiled files are storedpackageDir
: 'packages' - Directory where the output ZIP file is storedpackageName
: 'lambda-function.zip' - Name of the output ZIP file
To customize the configuration, create a lambda-package-config.json
file in your project's root directory:
{
"distDir": "build",
"packageDir": "deploy",
"packageName": "my-lambda.zip"
}
If the configuration file doesn't exist on the first run, it will be automatically created with default settings.
Using in Your Project
You can also add it to your package.json scripts:
"scripts": {
"package": "lambda-package"
}
Then run:
npm run package
License
Author
ABfry