Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): allow to provide glob expressions for linked and ignore packages #458

Merged
merged 7 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/config-file-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ There are two caveats to this.

These restrictions exist to ensure your repository or published code do not end up in a broken state. For a more detailed intricacies of publishing, check out our guide on [problems publishing in monorepos](./problems-publishing-in-monorepos).

> NOTE: you can also provide glob expressions to match the packages, according to the [micromatch](https://www.npmjs.com/package/micromatch) format.
emmenko marked this conversation as resolved.
Show resolved Hide resolved

## `linked` (array of package names)

This option can be used to declare that packages should 'share' a version, instead of being versioned completely independently. As an example, if you have a `@changesets/button` component and a `@changesets/theme` component and you want to make sure that when one gets bumped to `2.0.0`, the other is also bumped to `2.0.0`. To achieve this you would have the config:
Expand Down
18 changes: 18 additions & 0 deletions docs/linked-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,21 @@ I now have another changeset with a major for `pkg-a` and I do a release, the re

- `pkg-a` is at `3.0.0`
- `pkg-b` is at `2.0.0`

## Using glob expressions

Sometimes you want to link many or all packages within your project (for example in a monorepository setup), in which case you would need to keep the list of linked packages up-to-date.

To make it simpler to maintain that list, you can provide glob expressions in the linked list that would match and resolve to all the packages that you wish to include.

For example:

```json
{
"linked": [["pkg-*"]]
}
```

It will match all packages starting with `pkg-`.

**The glob expressions must be defined according to the [micromatch](https://www.npmjs.com/package/micromatch) format.**
4 changes: 3 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
"@changesets/logger": "^0.0.5",
"@changesets/types": "^3.1.0",
"@manypkg/get-packages": "^1.0.1",
"fs-extra": "^7.0.1"
"fs-extra": "^7.0.1",
"micromatch": "^4.0.2"
},
"devDependencies": {
"@types/micromatch": "^4.0.1",
"fixturez": "^1.1.0",
"jest-in-case": "^1.0.2"
}
Expand Down