Version Command

Supports all Melos filtering flags.

Automatically version and generate changelogs for all packages.

melos version

To learn more, visit the Automated Releases documentation.

Hooks#

The 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.

--prerelease (-p)#

Version any packages with changes as a prerelease. Cannot be combined with graduate flag. Defaults to false.

melos version --prerelease
melos version -p

--graduate (-g)#

Graduate 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 -g

--[no-]changelog (-c)#

Update CHANGELOG.md files (based on conventional commit messages). Defaults to true.

melos version --changelog
melos version -c

Use --no-changelog to disable.

--[no-]git-tag-version (-t)#

Create a git tag. Defaults to true.

melos version --git-tag-version
melos version -t

Use --no-git-tag-version to disable.

--[no-]release-url (-r)#

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 -r

Use --no-release-url to disable.

The default for this option can be configured in command/version/releaseUrl in your melos.yaml file.

--[no-]dependent-constraints#

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-constraints

Use --no-dependent-constraints to disable.

--[no-]dependent-versions#

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-versions

Use --no-dependent-versions to disable.

--all (-a)#

Version private packages that are skipped by default.

melos version --all
melos version -a

--preid#

When 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=beta

--dependent-preid#

This 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=beta

--message (-m)#

Override 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"

--manual-version (-V)#

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