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 not working as stated in docs? #2491

Closed
ConAntonakos opened this issue Jan 18, 2017 · 15 comments · Fixed by #2510
Closed

yarn version not working as stated in docs? #2491

ConAntonakos opened this issue Jan 18, 2017 · 15 comments · Fixed by #2510
Labels

Comments

@ConAntonakos
Copy link
Contributor

ConAntonakos commented Jan 18, 2017

Do you want to request a feature or report a bug?
Bug.

What is the current behavior?
yarn version returns the current version of yarn similar to the command yarn --version.

If the current behavior is a bug, please provide the steps to reproduce.
Run the command yarn version in your CLI.

What is the expected behavior?
Unless I'm misinformed, should it not be performing the behavior described in the docs? https://yarnpkg.com/en/docs/cli/version

Running yarn version should output something like the following:

info Current version: 1.0.1
question New version: 1.0.2
info New version: 1.0.2
✨  Done in 9.42s.

Please mention your node.js, yarn and operating system version.
node: 7.4.0
yarn: 0.19.1
os: macOS 10.11.6

@kinetifex
Copy link

Upgraded from 0.18.1 to 0.19.1 today and seeing this as well.
node: v6.7.0
yarn: 0.19.1
os: CentOS 7.3.1611

@danielstreit
Copy link

Also seeing this today after upgrading from 0.18.1 to 0.19.1.

node: v7.2.1
yarn: 0.19.1
os: macOS 10.12.2

0.18.1 still works as expected after downgrade.

@Daniel15
Copy link
Member

cc @bestander - Sounds like a regression in 0.19.x.

@bestander
Copy link
Member

Created an issue to track cherry-picks #2499.
Anyone wants to fix this bug and send a PR?

@ConAntonakos
Copy link
Contributor Author

ConAntonakos commented Jan 19, 2017

Thanks for confirming!

I was looking into it. It seems if I comment out L42, it works again. Still investigating...

Edit: That was slightly misleading for me. At L174, by args.unshifting, it gets set as a flag? Still going...

ConAntonakos pushed a commit to ConAntonakos/yarn that referenced this issue Jan 20, 2017
…rnpkg#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version` was shared. This relates to PR yarnpkg#2268.
ConAntonakos pushed a commit to ConAntonakos/yarn that referenced this issue Jan 20, 2017
…g#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version` was shared. This relates to PR yarnpkg#2268.
ConAntonakos pushed a commit to ConAntonakos/yarn that referenced this issue Jan 20, 2017
There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version` was shared. This relates to PR yarnpkg#2268.
ConAntonakos pushed a commit to ConAntonakos/yarn that referenced this issue Jan 20, 2017
There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR yarnpkg#2268.
ConAntonakos pushed a commit to ConAntonakos/yarn that referenced this issue Jan 20, 2017
…pkg#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR yarnpkg#2268.
@milesj
Copy link

milesj commented Jan 23, 2017

Same here. The upgrade to 0.19 simply outputs the yarn version now, instead of tagging a new version.

@markstos
Copy link
Contributor

Since it's a regression, git bisect could be used to find the commit that changed the behavior, to better understand the context of why the behavior changed.

ConAntonakos pushed a commit to ConAntonakos/yarn that referenced this issue Jan 25, 2017
…pkg#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR yarnpkg#2268.
ConAntonakos pushed a commit to ConAntonakos/yarn that referenced this issue Jan 30, 2017
…pkg#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR yarnpkg#2268.
@danny-andrews
Copy link

danny-andrews commented Jan 31, 2017

This is probably not the correct place to ask this, but Is there a way to rollback to an older version? I can't find a way to do it through brew.

@Daniel15
Copy link
Member

@danny-andrews Google returned this question on StackOverflow, maybe it'll be useful for you: https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula. I don't have a Mac any more so I can't test it though.

Alternatively, all the other methods of installing Yarn let you specify the version. If you use the installation script, you can pass a --version command-line argument (eg. ./install.sh --version 0.18.1).

@danny-andrews
Copy link

Yeah, I went through all those, but they don't seem to be valid anymore. I reverted to installing via npm for now. Thanks!

bestander pushed a commit that referenced this issue Feb 1, 2017
… (#2510)

* Fix `yarn version` which yields same output as `yarn --version` (#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR #2268.

* Shift first arg that shares name with an option to circumvent conflicting name bug

Relating to tj/commander.js#346, when an arg shares the same name as an
option, it wrongly ignores the arg command and executes the option
instead. Therefore, executing 'yarn version' would instead translate
to 'yarn --version'. This logic can subsequently be removed once this issue is resolved.
bestander pushed a commit that referenced this issue Feb 1, 2017
… (#2510)

* Fix `yarn version` which yields same output as `yarn --version` (#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR #2268.

* Shift first arg that shares name with an option to circumvent conflicting name bug

Relating to tj/commander.js#346, when an arg shares the same name as an
option, it wrongly ignores the arg command and executes the option
instead. Therefore, executing 'yarn version' would instead translate
to 'yarn --version'. This logic can subsequently be removed once this issue is resolved.
bestander pushed a commit that referenced this issue Feb 1, 2017
… (#2510)

* Fix `yarn version` which yields same output as `yarn --version` (#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR #2268.

* Shift first arg that shares name with an option to circumvent conflicting name bug

Relating to tj/commander.js#346, when an arg shares the same name as an
option, it wrongly ignores the arg command and executes the option
instead. Therefore, executing 'yarn version' would instead translate
to 'yarn --version'. This logic can subsequently be removed once this issue is resolved.
@bestander
Copy link
Member

Fix will be released in 0.20.1

mnsn pushed a commit to mnsn/yarn that referenced this issue Feb 15, 2017
…pkg#2491) (yarnpkg#2510)

* Fix `yarn version` which yields same output as `yarn --version` (yarnpkg#2491)

There was a conflict when commander attempts to parse the incoming args
between the command executed and the options since the name `version`
was shared. In other words, executing the command `yarn version`
would yield the same output as `yarn --version`. This relates to PR yarnpkg#2268.

* Shift first arg that shares name with an option to circumvent conflicting name bug

Relating to tj/commander.js#346, when an arg shares the same name as an
option, it wrongly ignores the arg command and executes the option
instead. Therefore, executing 'yarn version' would instead translate
to 'yarn --version'. This logic can subsequently be removed once this issue is resolved.
@markmsmith
Copy link

Sorry to comment on an old issue, but I think there's still a problem with the backwards compatibility of the yarn version command. We've been trying to make the switch from npm, but we found that yarn version doesn't support the ability to bump based on the existing value, eg yarn version minor, which we use in our CI setup.
Is it planned to support this functionality in the future, or is this an intentional departure from npm?
Thanks.

@bestander
Copy link
Member

I think there was a conscious choice to split yarn version that outputs data and yarn version --new-version that takes input.
I think major/minor/patch alias would be reasonable in e.g. yarn version --new-version patch.
If you want to discuss the api, @markmsmith, go ahead and start and RFC.

@IGx89
Copy link

IGx89 commented Dec 20, 2017

@markmsmith Did you ever pursue that? We're also looking to replace npm with yarn and are a bit surprised at how limited yarn version looks to be compared to npm version

@arichiardi
Copy link

Interested in this as well, npm version is handy for scripts after the version has been bumped

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

Successfully merging a pull request may close this issue.