Registry / aws / lerna-to-lambda

lerna-to-lambda

JSON →
library0.3.1jsnpmunverified

lerna-to-lambda (l2l) is a specialized utility designed for developers working with Lerna monorepos who need to deploy individual packages as AWS Lambda functions. At version 0.3.1, this tool facilitates the creation of compact, standalone deployment archives by intelligently bundling a specific monorepo package with only its necessary dependencies. It resolves the common challenge of dealing with hoisted `node_modules` in Lerna projects by copying direct and recursive subdependencies into a single `node_modules` structure within the output directory. A key differentiator is its ability to correctly handle both external npm packages and internal, inter-dependent monorepo packages, ensuring a self-contained runtime environment for Lambda. By default, it excludes `aws-sdk`, assuming it's provided by the Lambda runtime. While a powerful bundling solution, it is not a package manager itself; users must ensure all dependencies are installed via `yarn` or `npm` prior to execution. Its release cadence is likely feature-driven given its current version number.

npm install lerna-to-lambda
INSTALL
IMPORT
SIG · LERNA-TO-LAMBDA
L
lerna-to-lambda
awsjavascriptv0.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

l2l (CLI command)
npx l2l -i build -o lambda
import { l2l } from 'lerna-to-lambda'
This package is designed as a command-line interface (CLI) tool for bundling, not for programmatic JavaScript imports. Execute `l2l` via `npx`, `yarn`, or `npm` scripts.
Options (type)
import type { Options } from 'lerna-to-lambda';
import { Options } from 'lerna-to-lambda';
While `lerna-to-lambda` is primarily a CLI, its TypeScript declarations may expose types like `Options` for programmatic configuration or validation when used in a TypeScript project.
(No default export)
// No default export from 'lerna-to-lambda'
import l2l from 'lerna-to-lambda'
As a CLI-focused package, `lerna-to-lambda` does not provide a default export for direct programmatic use.

Demonstrates adding `lerna-to-lambda` as a dev dependency and integrating its `l2l` command into a TypeScript project's build workflow to create Lambda deployment packages.

yarn add -W --dev lerna-to-lambda // In package.json scripts for a Lerna package: "scripts": { "clean": "rimraf build lambda", "compile": "tsc -p tsconfig.build.json", "package": "l2l -i build -o lambda", "build": "yarn run clean && yarn run compile && yarn run package" }
l2l --version
Debug
Known issues
gotchalerna-to-lambda is not a package manager; it does not install or verify package versions. Users must ensure all dependencies (both internal monorepo and external npm) are correctly installed via `yarn` or `npm` *before* running `l2l`.
fix
Always run `yarn install` or `npm install` in your monorepo root to ensure `node_modules` is populated before invoking `l2l`.
affects: >=0.1.0
breakingThe dependency topology within the bundled `node_modules` can shift. Lerna-hoisted dependencies may be 'unhoisted' and moved into sub-`node_modules` directories within the package bundle. This rearrangement can potentially lead to unexpected behavior or break certain packages that rely on specific `node_modules` structures.
fix
Thoroughly test bundled Lambda functions after running `l2l`. Pay close attention to packages that might be sensitive to their location or to multiple versions of the same dependency. Consider using a `nohoist` strategy for problematic packages in Lerna if issues persist.
affects: >=0.1.0
gotchaBy default, `l2l` omits the `aws-sdk` dependency and its subdependencies from the bundle. This assumes `aws-sdk` is provided by the target AWS Lambda runtime environment. If your Lambda environment does not provide `aws-sdk` or requires a specific version not implicitly available, your function will fail.
fix
If `aws-sdk` is explicitly needed in your bundle, review `l2l` CLI options (e.g., `--no-omit-aws-sdk`) to include it. Verify the Lambda runtime's `aws-sdk` version compatibility with your function's requirements.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'my-internal-monorepo-package'
The internal Lerna package dependency was not correctly identified or copied into the Lambda bundle's `node_modules`.
fix
Ensure 'my-internal-monorepo-package' is listed in the `package.json` dependencies of the target Lambda package. Verify that Lerna has correctly linked it before running `l2l`.
Runtime.ImportModuleError: Error: Cannot find module 'some-external-npm-dependency'
An external npm package required by your Lambda function was not installed or bundled correctly before deployment.
fix
Run `yarn install` or `npm install` in your monorepo root to ensure all external dependencies are installed. Confirm `l2l` is running *after* this installation step in your build process.
EACCES: permission denied, mkdir '/path/to/output'
The `l2l` command does not have sufficient permissions to create the output directory or write files within it.
fix
Ensure the user executing `l2l` has write permissions to the specified output directory. You might need to adjust directory permissions or run the command with elevated privileges (e.g., `sudo`, or correct user setup in CI/CD).
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
lerna-to-lambda — npm install lerna-to-lambda · libregistry