npm-lambda-pack

Npm pack for Lambda

Usage no npm install needed!

<script type="module">
  import npmLambdaPack from 'https://cdn.skypack.dev/npm-lambda-pack';
</script>

README

npm-lambda-pack

npm pack for Lambda.

Installation

npm i npm-lambda-pack

Usage

const { pack } = require('npm-lambda-pack');

pack({
  pkgJson: require('path/to/lambda/package.json'),
  pkgDir: 'path/to/lambda',
}), (err, esult) => {
  // ...
});

pack(options, callback)

  • options.pkgJson
    • package.json that dependencies are packed.
  • options.pkgDir
    • A path that the package.json is located.
  • options.cacheBaseDir
    • A path of a base directory that cache a packed package on.
  • options.exclude
    • A glob pattern of files that are not add into the zip file.
  • callback(err, result)
    • A function that is callback when packing is completed.
    • err - An Error object when an error is occured.
    • result.zip - An instance of the JSZip.

Related

License

MIT