Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn version - automatic version bump #5367

Open
CzBuCHi opened this issue Feb 16, 2018 · 4 comments
Open

yarn version - automatic version bump #5367

CzBuCHi opened this issue Feb 16, 2018 · 4 comments

Comments

@CzBuCHi
Copy link

CzBuCHi commented Feb 16, 2018

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]
@ghost ghost assigned rally25rs Feb 16, 2018
@ghost ghost added the triaged label Feb 16, 2018
rally25rs pushed a commit that referenced this issue Apr 15, 2018
fixes #5670 

**Summary**

Currently, it's possible (although undocumented) to automatically bump the version by running something like `yarn version --loose-semver --new-version minor`. To me, this seems less convenient and less intuitive than something like `yarn version --minor` (closely comparable to `npm version minor`). I've added the ability to automatically increment the version with one of the flags: `--major`, `--minor`, or `--patch`. This will also satisfy feature request #5367.

**Test plan**

I've included Jest test cases for each of the new versioning flags.
@gera2ld
Copy link

gera2ld commented May 29, 2018

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

@daniseijo
Copy link
Contributor

I've implemented this behaviour similar to how it works on npm. Be free to comment or contrbute on the pull request: #7336

@DmytroSokhach
Copy link

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

@eric-burel
Copy link

eric-burel commented Jun 26, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants