bun install will create a lockfile called bun.lock. Should it be committed to git?
YesGenerate a lockfile without installing?
To generate a lockfile without installing tonode_modules you can use the --lockfile-only flag. The lockfile will always be saved to disk, even if it is up-to-date with the package.json(s) for your project. bun install --lockfile-only
Using
--lockfile-only will still populate the global install cache with registry metadata and git/tarball dependencies.Can I opt out?
To install without creating a lockfile:bun install --no-saveTo install a Yarn lockfile in addition to
bun.lock. terminalbunfig.tomlbun install --yarn
Text-based lockfile
Bun v1.2 changed the default lockfile format to the text-basedbun.lock. Existing binary bun.lockb lockfiles can be migrated to the new format by running bun install --save-text-lockfile --frozen-lockfile --lockfile-only and deleting bun.lockb. More information about the new lockfile format can be found on our blogpost. Automatic lockfile migration
When runningbun install in a project without a bun.lock, Bun automatically migrates existing lockfiles: -
yarn.lock(v1) -
package-lock.json(npm) -
pnpm-lock.yaml(pnpm)