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 · all subjects

workspace & monorepo

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

Workspaces support in Bun's package manager

Bun's package manager supports npm "workspaces". Workspaces split a codebase into distinct packages that live in the same repository, can depend on each other, and (when possible) share a node_modules directory.

Root package.json structure for workspaces

The root package.json should not contain "dependencies", "devDependencies", or other dependency fields. Each package should be self-contained and declare its own dependencies. It is conventional to declare "private": true to avoid accidentally publishing the root package to npm. The root package.json should include a "workspaces" field specifying glob patterns for workspace locations.

Basic monorepo root package.json example

An example root package.json with workspaces configured: { "name": "my-monorepo", "private": true, "workspaces": ["packages/*"] }

Workspace package directory structure

It is common to place all packages in a packages directory. The "workspaces" field in package.json supports glob patterns, so packages/* treats each subdirectory of packages as a separate package (also known as a workspace).

Adding dependencies between workspaces with workspace:* syntax

To add dependencies between workspaces, use the "workspace:*" syntax. For example, to add stuff-a as a dependency of stuff-b, in packages/stuff-b/package.json use: { "name": "stuff-b", "dependencies": { "stuff-a": "workspace:*" } }

Workspace dependency linking behavior with isolated installs

New workspaces use isolated installs by default. With isolated installs, Bun installs the package into the root node_modules/.bun store and symlinks it from the workspace's own node_modules. With --linker hoisted flag, Bun hoists the package into the root node_modules instead.

Give your agent this brain