Bun
On this page
cooldown gates Bun projects through --tool bun.
What it reads#
A Bun project is a package.json with its text bun.lock, the lock cooldown reads. A project with
only the binary bun.lockb is no Bun project to it.
Registry#
Publish times come from the npm registry.
How it is driven#
cooldown runs bun, or the program COOLDOWN_BUN names:
check: proves the lock current, as described below.upgradeandfix: verify the lock they wrote the same waycheckdoes.--build: runsbun install.
How check proves the lock current#
check asks Bun itself whether the lock is current. It needs a stable Bun 1.4.5 or newer, the
oldest release measured to leave the project alone: an older or prerelease Bun leaves the lock
lock_unknown.
It runs bun install --frozen-lockfile --dry-run --ignore-scripts in the project, which installs
nothing. Bun’s install cache and temporary files are kept in cooldown’s cache directory and
BUN_OPTIONS is ignored, so the project, its node_modules included, stays byte for byte as it
was.
Bun’s verdict decides the result:
- A refusal of a lock that has changes: a stale lock that
--allow-stale-lockwaives, but only when it is Bun’s sole error. - Any other Bun failure:
tool_failed, such as a registry or resolution error or a lock Bun could not load.
Under --offline Bun runs offline too. It still proves a current lock from the lock alone, but a
stale lock whose resolution needs registry metadata Bun has not cached is tool_failed rather than
stale.
Edge cases#
The lock is lock_unknown rather than current wherever the probe cannot establish what Bun
verifies:
- no readable text
bun.lock; - a configuration that disables Bun’s install cache, under which Bun writes into the project:
[install] cache = falseor[install.cache] disable = truein the project’sbunfig.tomlor the global.bunfig.toml;- any line in the project’s or the user’s
.npmrcthat may setcacheother than a plaincache,cache=true, orcache=<path>, such ascache=false # comment,cache = ' false ', orcache=${VAR}; - a
.envfile Bun loads (.env,.env.local,.env.<NODE_ENV>,.env.<NODE_ENV>.local) that mentionsNPM_CONFIG_USERCONFIG, which chooses the user.npmrc;
- an enclosing directory whose
package.jsondeclares workspaces, which Bun could run the project as a member of; trustedDependenciesin any workspace manifest or the lock, orpatchedDependenciesin the root manifest or the lock, since a frozen install compares neither;- a local
file:orlink:dependency in the lock, whose own manifest Bun does not compare; - a workspace pattern other than a literal path or a path ending in
/*; - workspace members other than those the lock records, such as a new member named like a locked registry package, or a member’s name, version, or declarations differing from what the lock recorded for it, which Bun’s frozen check passes.
Every npm-family tool owns package.json, so two of them at one root take turns under upgrade,
fix and --lock; see Several ecosystems at once.