yarn version - automatic version bump

Created on 16 Feb 2018  路  4Comments  路  Source: yarnpkg/yarn

request a feature

What is the current behavior?
calling yarn version will prompt for new version - cannot be used by automated builds

What is the expected behavior?

ability to auto-increase version without prompt:

package.json version  before -> after

yarn version --major  1.0.0  -> 2.0.0
yarn version --minor  1.0.0  -> 1.1.0
yarn version --patch  1.0.0  -> 1.0.1
yarn version --pre    1.0.0  -> 1.0.0-next      (not sure about this one ...)

Please mention your node.js, yarn and operating system version.

npm -v       5.6.0
node -v      v9.4.0
yarn -v      1.3.2
ver          Microsoft Windows [Version 10.0.16299.248]
cat-feature triaged

Most helpful comment

Will something like --pre be supported in the future?
NPM has npm version [premajor | preminor | prepatch | prerelease] for pre-releases, which are useful sometimes.
I think we can combine --pre with other flags to bump pre-releases.

yarn version --pre --major    1.0.0 -> 2.0.0-0
yarn version --pre --minor    1.0.0 -> 1.1.0-0
yarn version --pre --patch    1.0.0 -> 1.0.1-0
yarn version --pre            1.0.0-alpha.0 -> 1.0.0-alpha.1

Ref: https://docs.npmjs.com/cli/version

All 4 comments

Will something like --pre be supported in the future?
NPM has npm version [premajor | preminor | prepatch | prerelease] for pre-releases, which are useful sometimes.
I think we can combine --pre with other flags to bump pre-releases.

yarn version --pre --major    1.0.0 -> 2.0.0-0
yarn version --pre --minor    1.0.0 -> 1.1.0-0
yarn version --pre --patch    1.0.0 -> 1.0.1-0
yarn version --pre            1.0.0-alpha.0 -> 1.0.0-alpha.1

Ref: https://docs.npmjs.com/cli/version

I've implemented this behaviour similar to how it works on npm. Be free to comment or contrbute on the pull request: https://github.com/yarnpkg/yarn/pull/7336

I guess this one is already implementd and may be closed
https://classic.yarnpkg.com/en/docs/cli/version

This does not seem to exist in Yarn v1.21.1. I remember using this and suddenly I get error Use the "--new-version [version]" flag to create a new version.
Edit: I think you need yarn 2.0 or more

Was this page helpful?
0 / 5 - 0 ratings