new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · Package manager · all subjects

update: core behavior & modes

30 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

bun update basic syntax

bun update <package> updates a dependency to the latest version that satisfies the semver range in package.json. bun update without arguments updates all dependencies.

bun update --latest flag

bun update @types/bun --latest updates to the latest version, ignoring semver constraints. bun update --latest updates all dependencies to their latest versions.

Update versions across monorepo by changing root catalog

To update versions across all packages, change the version in the root package.json catalog or catalogs field. Then run bun install to update all packages.

bun update basic functionality

bun update (alias bun up) updates every dependency, direct and transitive, to the newest version allowed by the ranges that request it. It then rewrites package.json and bun.lock.

bun update with specific packages and patterns

To update specific packages, pass their names as arguments. Names can be glob patterns, and ! excludes packages. For example: bun update zod, bun update jquery@3, bun update '@types/*', bun update '@babel/*' '!@babel/core'.

bun update specific package transitive behavior

bun update <package> updates <package> everywhere it appears in bun.lock and leaves everything else alone. This works for transitive dependencies too. A name that is not in bun.lock is an error.

bun update output format

Updated packages appear in the install summary as '↑ name old → new', with '(v3.0.0 available)' when a newer major is out of range. Use --dry-run to preview changes.

bun update package.json rewriting behavior

Bun rewrites ^1.1.0 → ^1.2.0 and ~1.1.0 → ~1.1.5, preserving the operator. With install.exact or --exact, Bun writes an exact version instead. Exact pins, dist-tags ("latest", "next"), and other range forms (*, 1.x, >=1.0.0) are left as written; only bun.lock moves. --latest rewrites them. Bun never rewrites catalog: references; it updates the catalog entry in the root package.json instead. --no-save updates node_modules only, leaving package.json and bun.lock untouched.

bun update range widening restriction

Bun never widens ranges. A package that depends on foo@^1.0.0 never gets foo@2.x.

bun update patchedDependencies behavior

Versions in patchedDependencies stay put as long as their range allows. Bun reports them as 'kept name@version (patched, v1.2.3 available)'. --latest and bun audit fix do move them; re-create the patch with bun patch afterwards.

bun update transitive dependency registry failure handling

If a registry request for a transitive package fails, that package keeps its locked version and Bun prints a warning. A failed request for a direct dependency is an error.

bun update --interactive flag

Use the --interactive flag (short form -i) to choose which packages to update. This opens a terminal interface listing every outdated direct dependency. Bun updates the packages you select as if you had run bun update <name> ...; everything else keeps its locked version.

bun update --interactive interface sections

The interactive interface displays packages grouped by dependency type in sections: dependencies, devDependencies, peerDependencies, optionalDependencies. Each section shows column headers aligned with the package data.

bun update --interactive interface columns

The interactive interface shows four columns: Package (may have a suffix such as ' dev', ' peer', or ' optional'), Current (currently installed version), Target (version that would be installed, respects semver constraints), Latest (latest available version).

bun update --interactive keyboard controls

Selection controls: Space toggles package selection, Enter confirms and updates, a/A selects all, n/N selects none, i/I inverts selection. Navigation: ↑/↓ arrow keys or j/k move cursor, l/L toggles between target and latest version. Exit: Ctrl+C or Ctrl+D cancels without updating.

bun update --interactive visual indicators

■ indicates selected packages (will be updated), □ indicates unselected packages, ❯ shows current cursor position. Colors: Red for major version changes, yellow for minor, green for patch. Underlined text shows the currently selected update target.

bun update --recursive flag

In a monorepo, bun update only rewrites the package.json of the workspace you run it in. The --recursive flag (-r) updates every workspace's package.json.

bun update --filter flag

The --filter flag (-F) updates only the matching workspaces, using the filter syntax. As with bun install --filter, Bun links only the selected workspaces afterwards.

bun update recursive and filter examples

Examples of --recursive and --filter usage: bun update --recursive, bun update --filter './packages/*', bun update -i -r, bun update zod -r, bun update zod --filter '...^ui'.

bun update --dev flag

The --dev flag (-D) restricts bun update to update devDependencies only.

bun update --prod flag

The --prod flag (-P) restricts bun update to update dependencies and optionalDependencies only.

bun update --no-optional flag

The --no-optional flag skips optionalDependencies during bun update.

bun update type restriction flags behavior

The --dev, --prod, and --no-optional flags only select what to update. bun update --prod still installs devDependencies.

bun update type restriction flag examples

Examples of type restriction: bun update --dev, bun update --prod --latest, bun update -D '@types/*', bun update -i --prod.

bun update --global flag

bun update -g updates packages installed with bun add -g.

bun update --global examples

Examples: bun update -g, bun update -g typescript.

bun update --latest flag

By default, bun update updates each dependency to the latest version that satisfies the version range in package.json. To update direct dependencies to the latest version regardless of the declared range, use --latest (-L). Bun rewrites the package.json entry to a range of the same style on the new version. Transitive dependencies still respect the ranges their dependents declare. Bun does not downgrade a dependency that is already ahead of latest (e.g. a prerelease).

bun update --latest in interactive mode

In interactive mode, press 'l' to toggle a package between its target version (respecting semver) and the latest version.

bun update --latest example

With package.json containing "react": "^17.0.2": bun update updates to a version matching 17.x, while bun update --latest updates to a version matching 18.x or later.

Difference between --latest and --interactive in bun update

--latest updates direct dependencies to the latest version regardless of the declared range and rewrites package.json entries. --interactive opens a terminal interface to choose which packages to update, respecting semver constraints by default but allowing toggling to latest per package.

Give your agent this brain