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

workspaces

4 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 key in package.json

The 'workspaces' key in the root package.json lists the subdirectories to treat as workspaces. It supports full glob syntax, including negative patterns such as !**/excluded/**. Example: 'workspaces': ['packages/*'] or 'workspaces': ['packages/**', '!packages/**/test/**', '!packages/**/template/**'].

Workspace protocol for dependencies

To reference another package in a monorepo, use a semver range or the workspace protocol as the version in package.json. The workspace protocol uses the format workspace:* for any version, workspace:^ for caret ranges, and workspace:~ for tilde ranges. A specific version like workspace:1.0.2 takes precedence over the package's package.json version.

Monorepo code organization benefits

Workspaces provide three major benefits: code can be split into logical parts with packages as dependencies installed from local node_modules instead of npm registry; dependencies can be de-duplicated and hoisted to the root node_modules directory to save disk space; scripts can be run in multiple packages using the --filter flag or across all workspaces using --workspaces.

Typical monorepo structure

A monorepo commonly has a root package.json with a 'workspaces' key, a bun.lock file, and a packages directory containing subdirectories for each workspace. Each workspace subdirectory contains its own package.json, source files, and optional tsconfig.json.

Give your agent this brain