Skip to content

Commit a11a102

Browse files
committed
adding documentation
1 parent f9571c4 commit a11a102

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
category: features
3+
slug: /features/catalogs
4+
title: "Catalogs"
5+
description: Centralize dependency version management across your workspace with reusable version catalogs.
6+
---
7+
8+
## Overview
9+
10+
Catalogs provide centralized dependency version management for workspaces. Inspired by [pnpm's catalog functionality](https://pnpm.io/catalogs), they allow you to define version ranges in your `.yarnrc.yml` and reference them across multiple `package.json` files using the `catalog:` protocol.
11+
12+
This eliminates version duplication, ensures consistency across packages, and makes dependency upgrades much simpler — update one place instead of many files.
13+
14+
:::info
15+
The catalog plugin is included by default starting from Yarn 4.10.0.
16+
:::
17+
18+
### Basic usage
19+
20+
Define a catalog in your `.yarnrc.yml`:
21+
22+
```yaml
23+
catalog:
24+
react: ^18.3.1
25+
lodash: ^4.17.21
26+
```
27+
28+
Reference entries in your `package.json`:
29+
30+
```json
31+
{
32+
"dependencies": {
33+
"react": "catalog:",
34+
"lodash": "catalog:"
35+
}
36+
}
37+
```
38+
39+
## Named catalogs
40+
41+
You can define multiple named catalogs using the `catalogs` field for different purposes:
42+
43+
```yaml
44+
catalog:
45+
lodash: ^4.17.21
46+
47+
catalogs:
48+
react18:
49+
react: ^18.3.1
50+
react-dom: ^18.3.1
51+
react17:
52+
react: ^17.0.2
53+
react-dom: ^17.0.2
54+
```
55+
56+
Reference named catalogs by specifying the name:
57+
58+
```json
59+
{
60+
"dependencies": {
61+
"lodash": "catalog:",
62+
"react": "catalog:react18"
63+
}
64+
}
65+
```
66+
67+
## Supported fields
68+
69+
The `catalog:` protocol works in `dependencies`, `devDependencies`, `peerDependencies`, and `optionalDependencies`.

packages/plugin-catalog/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This plugin adds support for centralized dependency version management through c
44

55
## Install
66

7-
This plugin is included by default starting from Yarn 4.10.
7+
This plugin is included by default starting from Yarn 4.10.0.
88

99
## Usage
1010

0 commit comments

Comments
 (0)