cooldown

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.
  • upgrade and fix: verify the lock they wrote the same way check does.
  • --build: runs bun 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-lock waives, 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 = false or [install.cache] disable = true in the project’s bunfig.toml or the global .bunfig.toml;
    • any line in the project’s or the user’s .npmrc that may set cache other than a plain cache, cache=true, or cache=<path>, such as cache=false # comment, cache = ' false ', or cache=${VAR};
    • a .env file Bun loads (.env, .env.local, .env.<NODE_ENV>, .env.<NODE_ENV>.local) that mentions NPM_CONFIG_USERCONFIG, which chooses the user .npmrc;
  • an enclosing directory whose package.json declares workspaces, which Bun could run the project as a member of;
  • trustedDependencies in any workspace manifest or the lock, or patchedDependencies in the root manifest or the lock, since a frozen install compares neither;
  • a local file: or link: 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.

Esc

Type # for headings only ↑↓ move ↵ open Ctrl ↵ new tab Ctrl U/D scroll preview

Keyboard shortcuts

/ ⌘ K Ctrl K
Search
← →
Previous or next page
?
Show these shortcuts