bun pm command group provides a set of utilities for working with Bun’s package manager.
pack
To create a tarball of the current workspace:terminal
.tgz file containing all files that would be published to npm, following the same rules as npm pack.
Examples
Basic usage:terminal
terminal
terminal
Options
--dry-run: Perform all tasks except writing the tarball to disk. Shows what would be included.--destination <dir>: Specify the directory where the tarball will be saved.--filename <name>: Specify an exact file name for the tarball to be saved at.--ignore-scripts: Skip running pre/postpack and prepare scripts.--gzip-level <0-9>: Set a custom compression level for gzip, ranging from 0 to 9 (default is 9).--quiet: Only output the tarball filename, suppressing verbose output. Ideal for scripts and automation.
Note:--filenameand--destinationcannot be used at the same time.
Output Modes
Default output:terminal
terminal
--quiet flag is particularly useful for automation workflows where you need to capture the generated tarball filename for further processing.
bin
To print the path to thebin directory for the local project:
terminal
bin directory:
terminal
ls
To print a list of installed dependencies in the current project and their resolved versions, excluding their dependencies.terminal
terminal
whoami
Print your npm username. Requires you to be logged in (bunx npm login) with credentials in either bunfig.toml or .npmrc:
terminal
hash
To generate and print the hash of the current lockfile:terminal
terminal
terminal
cache
To print the path to Bun’s global module cache:terminal
terminal
migrate
To migrate another package manager’s lockfile without installing anything:terminal
untrusted
To print current untrusted dependencies with scripts:terminal
trust
To run scripts for untrusted dependencies and add totrustedDependencies:
terminal
trust command:
--all: Trust all untrusted dependencies.
default-trusted
To print the default trusted dependencies list:terminal
version
To display current package version and help:terminal
package.json:
terminal
patch, minor, major, premajor, preminor, prepatch, prerelease, from-git, or specific versions like 1.2.3. By default creates git commit and tag unless --no-git-tag-version was used to skip.
pkg
Managepackage.json data with get, set, delete, and fix operations.
All commands support dot and bracket notation:
terminal
terminal