A group is a set of packages that always release together, with one version and one tag. It is one unit in independent mode. Use a group for packages that must match, such as a library and its platform binaries, or a UI kit and the app built on it.
Add a group
Set independent, and list the members of each group by package name:
{
"independent": true,
"groups": {
"web": ["@acme/ui", "@acme/app"]
}
}The key is the group name. Each value is a list of package names. Packages that are in no group stay units of their own.
Groups need independent mode. In lockstep mode, all packages are already one unit, and a non-empty groups is an error. An empty {} is allowed.
Dense releases
When a group is released, every member gets the new version, changed or not.
This repository has @acme/core at 1.2.0, and the web group at 3.1.0. @acme/ui depends on @acme/core, and @acme/app depends on @acme/ui. Only @acme/ui changed:
$ bump minor --dryrun
BUMP web 3.1.0 → 3.2.0 (changed)
@acme/ui, @acme/app
EDIT @acme/app dependencies["@acme/ui"] ^3.1.0 → ^3.2.0
DONE Dry run; no files were written@acme/app did not change, but it gets 3.2.0 too. The line below BUMP lists the members, each after the members it depends on.
A group is also a dependent like any other unit. When only @acme/core changed:
$ bump minor
BUMP @acme/core 1.2.0 → 1.3.0 (changed)
BUMP web 3.1.0 → 3.1.1 (dependent)
@acme/ui, @acme/app
EDIT @acme/app dependencies["@acme/ui"] ^3.1.0 → ^3.1.1
EDIT @acme/ui dependencies["@acme/core"] ^1.2.0 → ^1.3.0
DONE Committed 41836fe release: @acme/core@1.3.0, web@3.1.1
Tagged @acme/core@1.3.0, web@3.1.1The group gets one tag, web@3.1.1. The {name} of the tag template is the group name.
Targets
A target can be the group name or the name of any member. Both select the whole group:
$ bump patch @acme/app --dryrun
BUMP web 3.1.0 → 3.1.1 (target)
@acme/ui, @acme/app
EDIT @acme/app dependencies["@acme/ui"] ^3.1.0 → ^3.1.1
DONE Dry run; no files were writtenbump patch web gives the same release.
Members
- Each member must be a package that bump finds. See Packages.
- Each member must have a version.
- A package can be in one group only.
- All members must have the same version in their manifests. This is the group version.
To make a group from packages with different versions, first set one version in all of their manifests.
Group names
- The group name goes into each tag of the group, so the tag must be a valid git ref name. A name such as
my webgives tags such asmy web@3.1.0, and bump stops withInvalid tag name: "my web@3.1.0". - A group can have the name of one of its own members. For example,
"@acme/ui": ["@acme/ui", "@acme/app"]gives the tags@acme/ui@3.1.0,@acme/ui@3.2.0, and so on. - A group cannot have the name of a package that is not its member.
Rename a group, or add one
The tags of a group carry its name. After you rename a group, or put tagged packages into a new group, the group has no tag for its version:
$ bump patch
FAIL No tag found for 1 unit whose manifest is past 0.0.0
│
│ web manifest 3.1.0 expected tag web@3.1.0
│
│ To continue from the last release, tag the commit that released it:
│ git tag -a web@3.1.0 -m web@3.1.0 <commit>
│
│ To use the manifest version as the base, run again with --adopt:
│ bump patch --adopt → web 3.1.1See No tag found for the two ways out.
Errors
Each of these stops bump before it writes a file:
| Problem | Message |
|---|---|
| A member is not a package. | Unknown package "@acme/nope" in group "web" |
| A member has no version. | Package "@acme/docs" in group "web" has no version |
| A package is in two groups. | Package "@acme/ui" is in groups "web" and "ui" |
| The group has the name of a package that is not its member. | Group "@acme/core" has the name of a package that is not its member |
| The members have different versions. | The members of "web" must share one version, then each member and its version |
| A group is empty. | "groups.web" must be a non-empty array of package names in "<file>" |
groups in lockstep mode. |
"groups" needs "independent": true in "<file>" |
Crates that share [workspace.package] version have more rules. See Cargo workspaces.