apply a new version to the current package
yarn version <strategy>Examples
Section titled “Examples”Immediately bump the version to the next major :
yarn version majorPrepare the version to be bumped to the next major :
yarn version major --deferredDetails
Section titled “Details”This command will bump the version number for the given package, following the specified strategy:
-
If
major, the first number from the semver range will be increased (X.0.0). -
If
minor, the second number from the semver range will be increased (0.X.0). -
If
patch, the third number from the semver range will be increased (0.0.X). -
If prefixed by
pre(premajor, …), a-0suffix will be set (0.0.0-0). -
If
prerelease, the suffix will be increased (0.0.0-X); the third number from the semver range will also be increased if there was no suffix in the previous version. -
If
decline, the nonce will be increased foryarn version checkto pass without version bump. -
If a valid semver range, it will be used as new version.
-
If unspecified, Yarn will ask you for guidance.
For more information about the --deferred flag, consult our documentation
(https://yarnpkg.com/features/release-workflow#deferred-versioning).
Options
Section titled “Options”| Definition | Description |
|---|---|
| Prepare the version to be bumped during the next release cycle |
| Bump the version immediately |
| any single member of your team inside the same project - by doing this you | |
| ensure that you have control over Yarn upgrades and downgrades (including on | |
| your deployment servers), and get rid of most of the headaches related to | |
| someone using a slightly different version and getting different behavior. |
The version specifier can be:
-
a tag:
-
latest/berry/stable-> the most recent stable berry (>=2.0.0) release -
canary-> the most recent canary (release candidate) berry (>=2.0.0) release -
classic-> the most recent classic (^0.x || ^1.x) release -
a semver range (e.g.
2.x) -> the most recent version satisfying the range (limited to berry releases) -
a semver version (e.g.
2.4.1,1.22.1) -
a local file referenced through either a relative or absolute path
-
self-> the version used to invoke the command
Options
Section titled “Options”| Definition | Description |
|---|---|
| Set the yarnPath setting even if the version can be accessed by Corepack |
| Only lock the Yarn version if it isn’t already locked |