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

feat: allow cancelling yarn version with ctrl-c or empty version number #7064

Merged
merged 3 commits into from Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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