-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Do you want to request a feature or report a bug?
feature
What is the current behavior?
When yarn publish
is run, the command interactively asks the user for a new version to which it will bump the package and create a new git commit and tag (if inside a git repo). If a version is not provided (i.e. just enter is pressed), the command goes on to ask for login information as part of the next step. At this point, it is unclear to the user with what version yarn is proceeding (maybe it chose to bump patch by 1?) and what additional actions (side effects) yarn may perform.
What is the expected behavior?
After not receiving a new version from the user, yarn should print an info message to the effect of "Proceeding with current version: x.y.z". Alternatively, remove the yarn version
behavior from yarn publish
altogether and let it just be responsible for publishing.
Please mention your node.js, yarn and operating system version.
node -> 7.7.3
yarn -> 0.21.3
OS -> macOS Sierra 10.12.3
Part of the issue here is the yarn publish
docs don't mention anything about modifying the version. The unsuspecting user is thrown into a prompt for a new version when all that is expected is to publish the current state of the package without additional side effects.
Including the behavior of yarn version
in yarn publish
might be a convenient shortcut for some. But in its present undocumented state, it is unexpected and confusing. Seeing as yarn publish
invokes the same setVersion()
function as yarn version
, it may make sense to delegate the responsibility of bumping the package version to yarn version
and allow yarn publish
to just publish.
If the above is not practical for some reason, at the very least it may be helpful to print an info message when the user does not specify a new version telling them the current version will be used. Furthermore, it may also be helpful to explicitly state (as a message in the console or in the docs) that yarn publish
will not create a commit or tag if no new version is provided.