bun pm command group is a set of utilities for working with Bun’s package manager.
pack
To create a tarball of the current workspace:terminal
bun pm pack creates a .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>: The directory to save the tarball in.--filename <name>: An exact file name for the tarball.--ignore-scripts: Skip running pre/postpack and prepare scripts.--gzip-level <0-9>: Set the gzip compression level, from 0 to 9 (default 9).--quiet: Print only the tarball filename, suppressing the rest of the output. Useful in scripts.
Note:--filenameand--destinationcannot be used at the same time.
Output Modes
Default output:terminal
terminal
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
trustedDependencies is set in package.json, Bun shows the packages from that list; otherwise it shows packages from its default trusted dependencies list.
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 it creates a git commit and tag; pass --no-git-tag-version to skip them.
pkg
Managepackage.json data with get, set, delete, and fix operations.
All commands support dot and bracket notation:
terminal
terminal