Skip to content

Commit

Permalink
feat: allow cancelling yarn version with ctrl-c or empty version numb…
Browse files Browse the repository at this point in the history
…er (#7064)

* feat: allow cancelling yarn version v1.12.3
info Current version: 1.15.0-0
Done in 0.06s. with ctrl-c or empty version number

* update changelog

* Update CHANGELOG.md
  • Loading branch information
ollelauribostrom authored and arcanis committed Feb 28, 2019
1 parent ea81393 commit 595006a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,11 +4,15 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa

## Master

- Makes `yarn version` cancellable via ctrl-c or empty string

[#7064](https://github.com/yarnpkg/yarn/pull/7064) - [**Olle Lauri Boström**](https://github.com/ollelauribostrom)

- Adds support for `yarn policies set-version berry`

[#7041](https://github.com/yarnpkg/yarn/pull/7041/files) - [**Maël Nison**](https://twitter.com/arcanis)

- Fix yarn `upgrade --scope` when using exotic (github) dependencies.
- Fixes yarn `upgrade --scope` when using exotic (github) dependencies

[#7017](https://github.com/yarnpkg/yarn/pull/7017) - [**Jeff Valore**](https://twitter.com/codingwithspike)

Expand Down
10 changes: 9 additions & 1 deletion src/cli/commands/version.js
Expand Up @@ -100,7 +100,15 @@ export async function setVersion(
break;
}

newVersion = await reporter.question(reporter.lang('newVersion'));
// Make sure we dont exit with an error message when pressing Ctrl-C or enter to abort
try {
newVersion = await reporter.question(reporter.lang('newVersion'));
if (!newVersion) {
newVersion = oldVersion;
}
} catch (err) {
newVersion = oldVersion;
}

if (!required && !newVersion) {
reporter.info(`${reporter.lang('noVersionOnPublish')}: ${oldVersion}`);
Expand Down

0 comments on commit 595006a

Please sign in to comment.