{"id":22382471,"url":"https://github.com/jcoreio/pack-lambda","last_synced_at":"2026-05-06T22:08:54.346Z","repository":{"id":78315471,"uuid":"433630834","full_name":"jcoreio/pack-lambda","owner":"jcoreio","description":".zip packager for AWS Lambda that behaves more like npm pack than other packages","archived":false,"fork":false,"pushed_at":"2024-06-03T18:46:35.000Z","size":768,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T19:45:38.481Z","etag":null,"topics":["aws","lambda","npm","pack","zip"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcoreio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-01T00:27:11.000Z","updated_at":"2024-06-03T18:45:57.000Z","dependencies_parsed_at":"2024-06-03T21:33:01.000Z","dependency_job_id":null,"html_url":"https://github.com/jcoreio/pack-lambda","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jcoreio/pack-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fpack-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fpack-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fpack-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fpack-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcoreio","download_url":"https://codeload.github.com/jcoreio/pack-lambda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fpack-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32713883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T19:35:05.142Z","status":"ssl_error","status_checked_at":"2026-05-06T19:35:03.996Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","lambda","npm","pack","zip"],"created_at":"2024-12-05T00:13:09.653Z","updated_at":"2026-05-06T22:08:54.316Z","avatar_url":"https://github.com/jcoreio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pack-lambda\n\n[![CircleCI](https://circleci.com/gh/jcoreio/pack-lambda.svg?style=svg)](https://circleci.com/gh/jcoreio/pack-lambda)\n[![Coverage Status](https://codecov.io/gh/jcoreio/pack-lambda/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/pack-lambda)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![npm version](https://badge.fury.io/js/pack-lambda.svg)](https://badge.fury.io/js/pack-lambda)\n\nGreat .zip packager and S3 uploader for AWS Lambda. Bundles only your `prod` dependencies\nthat are already installed, no need to prune or copy to a temp directory\nand do a fresh install. And it even works with dependencies installed by\n`pnpm`!\n\nSupports:\n\n- Scoped packages\n- Same filename as `npm pack`, except for extension\n- `prepack` package script\n- `--dry-run`\n- `--pack-destination`\n\nDoesn't currently support:\n\n- Packing other packages in args\n- `postpack` package script\n- `--json`\n- `--workspace`\n- `--workspaces`\n\n# Filenames\n\nThe default filename is `[name]-[version].zip` where `[name]` is the package name (scoped names like `@foo/bar`\nget converted to `foo-bar`) and `[version]` is the package version. If the version ends in `-development`,\na timestamp will be appened like `[name]-[version]-[timestamp].zip` so that the filename is always different\nand a CloudFormation stack update will always update the Lambda code.\n\n# Configuration\n\nYou can add the following config to `package.json`:\n\n```json\n{\n  \"@jcoreio/pack-lambda\": {\n    /**\n     * Excludes dependencies from getting bundled\n     * (aws-sdk is pre-installed in the Lambda runtime so you could do this to save space)\n     * This has no effect if your package.json contains bundledDependencies\n     */\n    \"excludeDependencies\": [\"aws-sdk\"]\n  }\n}\n```\n\n# CLI\n\n## `pack-lambda` - create a .zip file\n\n```\nnpx --package @jcoreio/pack-lambda pack-lambda\n\npack .zip file for AWS Lambda\n\nOptions:\n  --version                       Show version number                  [boolean]\n  --help                          Show help                            [boolean]\n  --dry-run                       display contents without writing file\n                                                      [boolean] [default: false]\n  --pack-destination              directory in which to save .zip files [string]\n```\n\n### Example Output\n\n```\n\u003e @jcoreio/pack-lambda@0.0.0-development prepack\n\n\u003c... prepack script output ...\u003e\n\n📦  @jcoreio/pack-lambda@0.0.0-development\n=== Zip Contents ===\nes/index.js.flow\nindex.js.flow\nes/types/npmcli__run-script/index.d.js\ntypes/npmcli__run-script/index.d.js\nbin/index.js\nes/bin/index.js\nes/index.js\nindex.js\npackage.json\nLICENSE.md\nREADME.md\nbin/index.d.ts\nes/bin/index.d.ts\nes/index.d.ts\nindex.d.ts\n=== Bundled Dependencies ===\n@aws-sdk/client-s3\n@aws-sdk/lib-storage\n@babel/runtime\n@npmcli/run-script\narchiver\nchalk\nfs-extra\nnpm-package-arg\nnpm-packlist\nyargs\n@aws-sdk/types\n=== Zip Details ===\nname:          @jcoreio/pack-lambda\nversion:       0.0.0-development\nfilename:      jcoreio-pack-lambda-0.0.0-development-20211205184649022.zip\nbundled deps:  11\ntotal files:   922\njcoreio-pack-lambda-0.0.0-development-20211205184649022.zip\n```\n\n## `upload` - upload to S3\n\n```\nnpx --package @jcoreio/pack-lambda pack-lambda upload \u003cbucket\u003e [key]\n\nupload .zip to S3\n\nPositionals:\n  bucket  S3 Bucket[/Key]                                             [required]\n  key     S3 Key\n\nOptions:\n  --version                       Show version number                  [boolean]\n  --help                          Show help                            [boolean]\n  --hash     compute hash and skip if already uploaded                 [boolean]\n\n```\n\n### Example Output\n\n```\n\u003e @jcoreio/pack-lambda@0.0.0-development prepack\n\n\u003c... prepack script output ...\u003e\n\n📦  @jcoreio/pack-lambda@0.0.0-development\n=== Zip Contents ===\nes/index.js.flow\nindex.js.flow\nes/types/npmcli__run-script/index.d.js\ntypes/npmcli__run-script/index.d.js\nbin/index.js\nes/bin/index.js\nes/index.js\nindex.js\npackage.json\nLICENSE.md\nREADME.md\nbin/index.d.ts\nes/bin/index.d.ts\nes/index.d.ts\nindex.d.ts\n=== Bundled Dependencies ===\n@aws-sdk/client-s3\n@aws-sdk/lib-storage\n@babel/runtime\n@npmcli/run-script\narchiver\nchalk\nfs-extra\nnpm-package-arg\nnpm-packlist\nyargs\n@aws-sdk/types\n=== Zip Details ===\nname:          @jcoreio/pack-lambda\nversion:       0.0.0-development\nfilename:      jcoreio-pack-lambda-0.0.0-development-20211205184649022.zip\nbundled deps:  11\ntotal files:   922\nUploading to s3://jcore-deploy/lambda/node/@jcoreio/pack-lambda/jcoreio-pack-lambda-0.0.0-development-20211205184649022.zip....done\n```\n\n# Node.js API\n\n## `writeZip`\n\n```js\nimport { writeZip } from '@jcoreio/pack-lambda'\n```\n\nPacks and writes a .zip to disk\n\n```ts\nimport { ManifestResult } from 'pacote'\n\nasync function writeZip(options?: {\n  /**\n   * The directory of the package to pack.  Defaults to process.cwd()\n   */\n  packageDir?: string\n  /**\n   * The directory to save .zip file in\n   */\n  packDestination?: string\n  /**\n   * If true, will output to stderr but not write to disk\n   */\n  dryRun?: boolean\n}): Promise\u003c{\n  /**\n   * The files that were packed (relative to packageDir)\n   */\n  files: string[]\n  /**\n   * The output .zip filename\n   */\n  filename: string\n  /**\n   * The package.json\n   */\n  manifest: ManifestResult\n}\u003e\n```\n\n## `uploadToS3`\n\n```js\nimport { uploadToS3 } from '@jcoreio/pack-lambda'\n```\n\nPacks and uploads a .zip to S3 (without writing anything to disk)\n\n```ts\nimport { ManifestResult } from 'pacote'\n\nexport async function uploadToS3(options: {\n  /**\n   * The directory of the package to pack.  Defaults to process.cwd()\n   */\n  packageDir?: string\n  /**\n   * The S3 bucket to upload to\n   */\n  Bucket: string\n  /**\n   * The S3 key to upload to.  Defaults to `lambda/node/${packageName}/${filename}`\n   */\n  Key?: string\n  /**\n   * If true, compute hash and append the hash to the filename; check if the S3 key\n   * already exists, and if so, skip upload.\n   */\n  useHash?: boolean\n}): Promise\u003c{\n  /**\n   * The files that were packed (relative to packageDir)\n   */\n  files: string[]\n  /**\n   * The output .zip filename\n   */\n  filename: string\n  /**\n   * The package.json\n   */\n  manifest: ManifestResult\n  /**\n   * The S3 bucket the .zip was uploaded to\n   */\n  Bucket: string\n  /**\n   * The S3 key the .zip was uploaded to\n   */\n  Key: string\n}\u003e\n```\n\n## `createArchive`\n\n```js\nimport { createArchive } from '@jcoreio/pack-lambda'\n```\n\nCreates an archive but doesn't write it to disk or upload it, it's up to you to pipe it somewhere\n\n```ts\nimport { Archiver } from 'archiver'\nimport { ManifestResult } from 'pacote'\n\nasync function createArchive(options: {\n  /**\n   * The directory of the package to pack\n   */\n  packageDir: string\n}): Promise\u003c{\n  /**\n   * The Archiver instance to stream to `pipe` to something else.\n   * Make sure to await `archive.finalize()` after piping it.\n   */\n  archive: Archiver\n  /**\n   * The files that were packed\n   */\n  files: string[]\n  /**\n   * The output filename\n   */\n  filename: string\n  /**\n   * The package.json\n   */\n  manifest: ManifestResult\n}\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fpack-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcoreio%2Fpack-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fpack-lambda/lists"}