Supports all Melos filtering flags.
Automatically version and generate changelogs for all packages.
melos versionTo learn more, visit the Automated Releases documentation.
To release from a branch other than the default branch, such as a hot-fix branch, visit the Releasing from Hot-fix Branches guide.
By default, each package is versioned independently, based on the commits that
touched that package. If you prefer all packages in the workspace to always
share the same version (also known as lockstep versioning, and similar to the
"fixed" release mode of tools like Nx and Lerna), set the
command/version/mode configuration to
fixed:
melos:
command:
version:
mode: fixedIn fixed mode, melos version:
- Determines a single new version for the whole workspace: the highest current package version, incremented by the most significant change across all packages (major if any package has a breaking change, minor if any package has a new feature, otherwise patch).
- Bumps every package in the workspace to that version, including packages without changes of their own. Their changelog notes that the version was bumped to keep the workspace in lockstep, while packages with changes get their regular changelog entries.
- Applies a manually specified version (
melos version <package> <version>) to all packages in the workspace. Relative version changes (major,minor,patchorbuild) are applied to the highest current version in the workspace, regardless of which package was named. - Leaves packages that are already at the new shared version untouched.
Private packages are still skipped unless --all is passed, and packages
excluded with filters (e.g. --ignore) are not bumped, so use filters with
care if you want the workspace to stay in sync. Since all packages are
versioned together, --no-dependent-versions has no effect in fixed mode.
If there are no versionable changes in any package, melos version does
nothing, just like in independent mode.
By default each package is still tagged individually, e.g. foo-v1.2.3. To
tag each release with a single plain version tag for the whole workspace
instead, e.g. v1.2.3, enable
command/version/workspaceTag:
melos:
command:
version:
mode: fixed
workspaceTag: trueThe version command supports the following hooks in addition to the
common hooks:
preCommit: Runs before the version commit is created. Allows you to make your own changes as part of versioning. You need to stage changes that you make yourself.
command:
version:
hooks:
preCommit: |
# Make changes to the version commit here.
# You need to stage changes that you make yourself.Version any packages with changes as a prerelease. Cannot be combined with
graduate flag. Defaults to false.
melos version --prerelease
melos version -pGraduate current prerelease versioned packages to stable versions, e.g.
"0.10.0-dev.1" becomes "0.10.0". Cannot be combined with prerelease flag.
Defaults to false.
melos version --graduate
melos version -gUpdate CHANGELOG.md files (based on conventional commit messages). Defaults to
true.
melos version --changelog
melos version -cUse --no-changelog to disable.
Create a git tag. Defaults to true.
melos version --git-tag-version
melos version -tUse --no-git-tag-version to disable.
Add a Signed-off-by trailer to the version commit, the same as passing
--signoff to git commit. Defaults to false.
melos version --sign-off
melos version -sUse --no-sign-off to disable.
The default for this option can be configured in
command/version/signOff in your root
pubspec.yaml file.
Melos runs git commit in your repository, so signing the commit with GPG or
SSH is handled by git itself. Set git config commit.gpgsign true (and
tag.gpgSign for the version tags) to have the commits created by Melos
signed.
Generate and print a link to the prefilled release creation page for each
package after versioning. Defaults to false.
melos version --release-url
melos version -rUse --no-release-url to disable.
The default for this option can be configured in
command/version/releaseUrl in your
root pubspec.yaml file.
Group changelog entries by their conventional commit type, e.g. all features
under a Features header and all fixes under a Bug Fixes header, instead of
listing them in a single flat list. Defaults to false.
melos version --group-commitsUse --no-group-commits to disable.
The default for this option can be configured in
command/version/changelogFormat/groupByType
in your root pubspec.yaml file.
Update dependency version constraints of packages in this workspace that depend on any of the packages that will be updated with this versioning run. (defaults to on)
melos version --no-dependent-constraintsUse --no-dependent-constraints to disable.
Make a new patch version and changelog entry in packages that are updated due to "--dependent-constraints" changes. Only usable with "--dependent-constraints" enabled and Conventional Commits based versioning. (defaults to on)
melos version --no-dependent-versionsUse --no-dependent-versions to disable.
Only bump dependent package versions and rewrite dependency constraints when declared SemVer constraints do not allow the updated version. When enabled, packages whose declared constraints already satisfy the new dependency version are skipped. (defaults to off)
melos version --smart-dependentsThe default for this option can be configured in
command/version/smartDependents
in your root pubspec.yaml file.
Version private packages that are skipped by default.
melos version --all
melos version -aWhen run with this option, melos version will increment prerelease versions
using the specified prerelease identifier, e.g. using a "beta" preid along with
the --prerelease flag would result in a version in the format
"1.0.0-1.0.beta.0". Applies only to Conventional Commits based versioning.
melos version --prerelease --preid=betaThis option is the same as --preid, but only applies to packages that are versioned due to a change in a dependency version. When this option is not provided but the --preid option is, the value of the --preid option will be used instead.
melos version --prerelease --dependent-preid=betaOverride the release's commit message. If the message contains
{new_package_versions}, it will be replaced by the list of newly versioned
package names. If --message is not provided, the message will default to:
chore(release): publish packages
{new_package_versions}Example:
melos version --message="chore(release): publish new versions"Manually specify a version change for a package. Can be used multiple times.
Each value must be in the format
<package name>:<major|patch|minor|build|exactVersion>. Cannot be combined with
--graduate or --prerelease flag.
melos version --manual-version=foo:patch
melos version --manual-version=foo:1.0.0
melos version -V foo:1.0.0
# To manually version multiple packages
melos version --manual-version=foo:patch --manual-version=bar:major
melos version --manual-version=foo:1.0.0 --manual-version=bar:1.0.0
melos version -V foo:1.0.0 -V bar:2.0.0
