Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Since Yarn 4.10.0, Yarn natively supports catalogs for managing dependency versi
- **Supporting hierarchical catalog inheritance** (e.g., `stable/canary` inherits from `stable`)
- **Providing validation** to ensure consistent catalog usage across workspaces
- **Auto-applying default catalogs** when adding dependencies
- **Ignoring specific workspaces** from catalog enforcement
- **Filtering workspaces** with opt-in (`includedWorkspaces`) and opt-out (`ignoredWorkspaces`) options

## Requirements

Expand All @@ -32,9 +32,10 @@ yarn plugin import https://raw.githubusercontent.com/toss/yarn-plugin-catalogs/m
# catalogs.yml

options:
default: [stable] # Optional: Default catalog groups for 'yarn add'
validation: warn # Optional: 'warn' | 'strict' | 'off'
ignoredWorkspaces: [] # Optional: Workspaces to ignore
default: [stable] # Optional: Default catalog groups for 'yarn add'
validation: warn # Optional: 'warn' | 'strict' | 'off'
includedWorkspaces: [] # Optional: Workspaces to include
ignoredWorkspaces: [] # Optional: Workspaces to ignore

list:
root: # Special alias for the root catalog (accessed via catalog:)
Expand Down Expand Up @@ -243,9 +244,33 @@ list:

If your `package.json` has more `catalog:stable` dependencies than `catalog:beta`, running `yarn add next` will automatically use `catalog:stable`.

### Ignoring Workspaces
### Workspace Filtering

Disable catalog enforcement for specific workspaces using glob patterns:
Control which workspaces are included in catalog protocol processing using `includedWorkspaces` and `ignoredWorkspaces` options.

#### Including Workspaces

Use `includedWorkspaces` to specify which workspaces should be processed for catalogs. Only matching workspaces will receive catalog validation and default catalog auto-application:

```yaml
# In catalogs.yml
options:
includedWorkspaces: [apps-*, packages]

list:
stable:
react: npm:18.0.0
```

When `includedWorkspaces` is specified:
- Only matching workspaces receive validation warnings/errors
- Only matching workspaces have default catalogs auto-applied

If `includedWorkspaces` is not specified, all workspaces are included by default.

#### Ignoring Workspaces

Use `ignoredWorkspaces` to exclude specific workspaces from catalog processing:

```yaml
# In catalogs.yml
Expand All @@ -260,7 +285,8 @@ list:
Ignored workspaces:
- Won't receive validation warnings/errors
- Won't have default catalogs auto-applied
- Can still use `catalog:` protocol if needed
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a wrong description, so I have removed this line


`ignoredWorkspaces` takes precedence over `includedWorkspaces`.

### Validation

Expand Down
8 changes: 4 additions & 4 deletions bundles/@yarnpkg/plugin-catalogs.js

Large diffs are not rendered by default.

104 changes: 0 additions & 104 deletions sources/__tests__/ignored-workspaces.test.ts

This file was deleted.

Loading