You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin reads extended options from `catalogs.yml` in your project root:
32
+
### Catalog Management with `catalogs.yml`
33
+
34
+
Define your catalogs in a single `catalogs.yml` file with support for inheritance, then apply them to `.yarnrc.yml` using the `yarn catalogs apply` command.
35
+
36
+
**catalogs.yml:**
37
+
```yaml
38
+
options:
39
+
default: [stable/canary]
40
+
validation: warn
41
+
42
+
list:
43
+
root:
44
+
lodash: npm:4.17.21
45
+
46
+
stable:
47
+
react: npm:18.0.0
48
+
typescript: npm:5.1.0
49
+
50
+
stable/canary:
51
+
react: npm:18.2.0 # Overrides stable
52
+
# typescript: npm:5.1.0 (inherited from stable)
53
+
54
+
stable/canary/next:
55
+
react: npm:18.3.0 # Overrides stable/canary
56
+
# typescript: npm:5.1.0 (inherited from stable)
57
+
```
58
+
59
+
**Apply to .yarnrc.yml:**
60
+
```bash
61
+
yarn catalogs apply
62
+
# ✓ Applied 1 root catalog and 3 named catalog groups to .yarnrc.yml
63
+
```
64
+
65
+
**After applying, .yarnrc.yml contains:**
66
+
```yaml
67
+
catalog:
68
+
lodash: npm:4.17.21
69
+
70
+
catalogs:
71
+
stable:
72
+
react: npm:18.0.0
73
+
typescript: npm:5.1.0
74
+
75
+
stable/canary:
76
+
react: npm:18.2.0
77
+
typescript: npm:5.1.0 # Inherited and resolved
78
+
79
+
stable/canary/next:
80
+
react: npm:18.3.0
81
+
typescript: npm:5.1.0 # Inherited and resolved
82
+
```
83
+
84
+
This plugin reads extended options from the `options` field in `catalogs.yml`:
31
85
32
86
### Default Alias Groups
33
87
@@ -176,6 +230,30 @@ catalogs:
176
230
177
231
When a package exists in multiple groups, the strictest validation level applies (`strict` > `warn` > `off`).
178
232
233
+
## Commands
234
+
235
+
### `yarn catalogs apply`
236
+
237
+
Applies catalog definitions from `catalogs.yml` to `.yarnrc.yml`, resolving all inheritance and completely replacing existing catalog configurations.
238
+
239
+
**Usage:**
240
+
```bash
241
+
# Apply catalogs to .yarnrc.yml
242
+
yarn catalogs apply
243
+
244
+
# Preview changes without writing
245
+
yarn catalogs apply --dry-run
246
+
```
247
+
248
+
**Options:**
249
+
- `--dry-run`: Show what would be applied without modifying `.yarnrc.yml`
250
+
251
+
**Notes:**
252
+
- Completely replaces `catalog` and `catalogs` fields in `.yarnrc.yml`
253
+
- Preserves all other settings in `.yarnrc.yml`
254
+
- Validates inheritance chains before applying
255
+
- Resolves all inheritance relationships into flat catalog definitions
256
+
179
257
## Contributing
180
258
181
259
Contributions are welcome! Please feel free to submit a Pull Request.
0 commit comments