1.0.1 • Published 1 year ago

@victorykit/npm2lambda v1.0.1

Weekly downloads
-
License
DL-DE-BY-2.0
Repository
-
Last release
1 year ago

#npm2lambda

This program is a command-line tool for building AWS lambda layers and functions from NPM modules. It traverses an entire NPM module's dependency tree (recursively) and extracts dependencies, as well as peerDependencies for building a lambda layer. If a lib directory is specified (which can be any arbitrary directory), a lambda function will be built by copying the entire directory content. If no lib directory is specified, the root NPM module will be added as a child module to the lambda layer.

If NPM dependencies are platform-specific, make sure to execute this program inside an appropriate environment (e.g. Docker).

The Node.js version will be auto-detected and used for setting an explicit lambda layer path (e.g. nodejs/node18/node_modules).

Zipping the build artifact (though required by AWS Lambda) is not part of this program. Either use infrastructure-as-code tooling specific mechanisms ( e.g. assets in CDK), or build your own.

Getting Started

$ npm install -g @victorykit/npm2lambda
$ npm2lambda --help

alternatively install via Git

$ mkdir py-aws-spitzel && cd $_ && git clone https://bitbucket.org/victorykit/node-npm2lambda.git .
$ npm install -g

Assuming the current working directory is set to a legal NPM module:

Only build a lambda layer of dependencies

$ npm2lambda build . --ignore-module

Build a lambda layer of depdendencies and the root module itself

$ npm2lambda build .

Build a super clean lambda layer of depdendencies and the root module itself

$ npm2lambda build . \
    --ignore node_modules \
    --ignore build

Build a lambda layer of only the root module

$ npm2lambda build . --ignore-child-modules

Build only a lambda function of the root's distribution (dist) artifacts (under lib/).

$ npm2lambda build . lib/ --ignore-child-modules

Change build directory and remove version prefix

$ npm2lambda build . --disable-version-prefix --builddir build/other

License

DL-DE->BY-2.0

Datenlizenz Deutschland – Namensnennung – Version 2.0

(1) Jede Nutzung ist unter den Bedingungen dieser „Datenlizenz Deutschland – Namensnennung – Version 2.0" zulässig.

Die bereitgestellten Daten und Metadaten dürfen für die kommerzielle und nicht kommerzielle Nutzung insbesondere

vervielfältigt, ausgedruckt, präsentiert, verändert, bearbeitet sowie an Dritte übermittelt werden;
mit eigenen Daten und Daten Anderer zusammengeführt und zu selbständigen neuen Datensätzen verbunden werden;
in interne und externe Geschäftsprozesse, Produkte und Anwendungen in öffentlichen und nicht öffentlichen elektronischen Netzwerken eingebunden werden.

(2) Bei der Nutzung ist sicherzustellen, dass folgende Angaben als Quellenvermerk enthalten sind:

Bezeichnung des Bereitstellers nach dessen Maßgabe,
der Vermerk „Datenlizenz Deutschland – Namensnennung – Version 2.0" oder „dl-de/by-2-0" mit Verweis auf den Lizenztext unter www.govdata.de/dl-de/by-2-0 sowie
einen Verweis auf den Datensatz (URI).
Dies gilt nur soweit die datenhaltende Stelle die Angaben 1. bis 3. zum Quellenvermerk bereitstellt.

(3) Veränderungen, Bearbeitungen, neue Gestaltungen oder sonstige Abwandlungen sind im Quellenvermerk mit dem Hinweis zu versehen, dass die Daten geändert wurden.

Data licence Germany – attribution – version 2.0

(1) Any use will be permitted provided it fulfils the requirements of this "Data licence Germany – attribution – Version 2.0".

The data and meta-data provided may, for commercial and non-commercial use, in particular

be copied, printed, presented, altered, processed and transmitted to third parties;
be merged with own data and with the data of others and be combined to form new and independent datasets;
be integrated in internal and external business processes, products and applications in public and non-public electronic networks.

(2) The user must ensure that the source note contains the following information:

the name of the provider,
the annotation "Data licence Germany – attribution – Version 2.0" or "dl-de/by-2-0" referring to the licence text available at www.govdata.de/dl-de/by-2-0, and
a reference to the dataset (URI).
This applies only if the entity keeping the data provides the pieces of information 1-3 for the source note.

(3) Changes, editing, new designs or other amendments must be marked as such in the source note.

URL: http://www.govdata.de/dl-de/by-2-0
1.0.1

1 year ago

1.0.0

1 year ago