Docs/Protocols/Catalog Protocol

Catalog Protocol

How catalog dependencies work in Yarn.

The catalog: protocol lets dependencies reference version ranges declared in .yarnrc.yml instead of repeating the same ranges across many manifests.

catalog:
  react: ^19.0.0

catalogs:
  tooling:
    typescript: ^5.0.0
{
  "dependencies": {
    "react": "catalog:",
    "typescript": "catalog:tooling"
  }
}

catalog: without a name reads from the default catalog setting. catalog:name reads from the matching entry in catalogs.

Catalog entries are resolved during install to the range configured for the dependency ident. If the named catalog or dependency entry doesn’t exist, Yarn reports an error rather than falling back to another range.

Upgrading catalog entries#

yarn up leaves both the catalog: references and the entries of your catalogs alone, unless you tell it which catalog to upgrade: --catalog upgrades the matching entries of the default catalog, and --catalog=<name> those of a named catalog. Only that catalog is modified; the range of each matching entry is updated in .yarnrc.yml, following the same rules as the ranges declared in your manifests.

# Updates the `react` entry of the default catalog
yarn up --catalog react

# Updates the `typescript` entry of the `tooling` catalog (the name must be attached with `=`)
yarn up --catalog=tooling typescript

# Makes a dependency use another catalog
yarn up react@catalog:next

Running yarn up react when react is only declared through catalog: references fails with a message that tells which catalog to upgrade. If some workspaces declare react with a regular range, those are upgraded and the catalog is left untouched.

Peer dependencies#

Workspaces can also use catalog: and catalog:name in their peerDependencies. The peer range is then the range stored in the catalog for that dependency; it must be a semver range (such as ^19.0.0 or npm:^19.0.0), and Yarn reports an error if the catalog or the entry doesn’t exist.

{
  "peerDependencies": {
    "react": "catalog:"
  }
}

Packages are expected to never contain catalog: ranges once published: yarn pack and yarn npm publish replace them with the range from the catalog, in dependencies, devDependencies, optionalDependencies and peerDependencies alike. A catalog: peer range found in a package that isn’t part of the project is ignored and treated as *.