pnpm-pack packages pnpm projects and workspaces into a gzip-compressed tarball (.tgz) by default, a .zip archive when the destination path ends in .zip, or extracts package files to a directory when --extract is used.
Available commands:
package— package the nearest project (nearestpackage.json)workspace— package all workspace packages, or a filtered subset (nearestpnpm-workspace.yaml)
pnpm-pack package --version 1.2.3
pnpm-pack workspace --version 1.2.3By default, artifacts are written to ./lib. With --extract, the destination defaults to ./lib/package. Archive names follow <package-name>-<version>.tgz.
--version <semver>sets the version used for packaging and for resulting artifact names.--pack-destination <path>controls where artifacts are written. Use a.zipextension to produce a zip archive instead of a tarball.--extractextracts package files to a directory instead of writing an archive.--no-buildskips runningpnpm run buildbefore packaging.--productionand--developmentcreate an artifact that includes an isolatednode_modulesbased on pnpm deploy behavior.--no-optionalomits optional dependencies when--productionor--developmentis used.--no-redact-readmekeeps README-like file contents in packaged artifacts.--umask <octal>sets the file permission umask applied to archive entries and extracted files. Default:0o022. Use--umask 0to disable permission normalization.--silentsuppresses output from child commands (pnpm,tar, and build scripts).
Destination constraints:
--pack-destinationmust be a relative path.- With
--extract,--pack-destinationmust be a directory path (for exampledist/package). - Without
--extract,--pack-destinationmay be a directory path or an explicit archive path ending in.tgz/.tar.gz/.zip.
The output format is inferred from --pack-destination:
- Directory path or
.tgz/.tar.gzextension → gzip-compressed tarball (default). .zipextension → zip archive.
To produce a zip archive suitable for AWS Lambda with correct file permissions:
pnpm-pack package --version 1.2.3 --production --pack-destination dist/lambda.zipThe default umask 0o022 ensures files have 644 (rw-r--r--) and directories have 755 (rwxr-xr-x) permissions, which Lambda requires.
Creates an artifact for the nearest project.
Example:
pnpm-pack package --version 1.2.3 --pack-destination distPackages a workspace from the nearest workspace root (pnpm-workspace.yaml).
By default, the workspace archive is written to ./lib/<workspace-root-name>-<version>.tgz.
Workspace packaging also writes per-package tarballs under each selected package's lib/ directory.
Examples:
pnpm-pack workspace --version 1.2.3 --pack-destination dist
pnpm-pack workspace --version 1.2.3 --pack-destination dist/workspace.zip
pnpm-pack workspace --version 1.2.3 --filter @scope/app...
pnpm-pack workspace --version 1.2.3 --filter-prod @scope/app...Workspace selection:
--filterselects workspace packages using pnpm filtering selectors.--filter-prodapplies the same selector syntax but omitsdevDependencieswhen selecting dependency projects.--test-patternmarks test-file globs for pnpm changed-since filtering; see pnpm docs.--changed-files-ignore-patterndefines globs pnpm should ignore when computing changed projects; see pnpm docs.--workspace-concurrency <number>sets workspace command parallelism.