Skip to content

Commit

Permalink
Fix specifying a custom version via UI (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
dopecodez authored Jul 5, 2020
1 parent add34d2 commit 6b68244
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions source/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module.exports = async (options, pkg) => {
},
{
type: 'input',
name: 'version',
name: 'customVersion',
message: 'Version',
when: answers => !answers.version,
filter: input => version.isValidInput(input) ? version(pkg.version).getNewVersionFrom(input) : input,
Expand All @@ -105,7 +105,7 @@ module.exports = async (options, pkg) => {
type: 'list',
name: 'tag',
message: 'How should this pre-release version be tagged in npm?',
when: answers => options.runPublish && version.isPrereleaseOrIncrement(answers.version) && !options.tag,
when: answers => options.runPublish && (version.isPrereleaseOrIncrement(answers.customVersion) || version.isPrereleaseOrIncrement(answers.version)) && !options.tag,
choices: async () => {
const existingPrereleaseTags = await prereleaseTags(pkg.name);

Expand All @@ -121,9 +121,9 @@ module.exports = async (options, pkg) => {
},
{
type: 'input',
name: 'tag',
name: 'customTag',
message: 'Tag',
when: answers => options.runPublish && version.isPrereleaseOrIncrement(answers.version) && !options.tag && !answers.tag,
when: answers => options.runPublish && (version.isPrereleaseOrIncrement(answers.customVersion) || version.isPrereleaseOrIncrement(answers.version)) && !options.tag && !answers.tag,
validate: input => {
if (input.length === 0) {
return 'Please specify a tag, for example, `next`.';
Expand Down Expand Up @@ -193,7 +193,8 @@ module.exports = async (options, pkg) => {

return {
...options,
...answers,
version: answers.version || answers.customVersion,
tag: answers.tag || answers.customTag,
confirm: true,
repoUrl,
releaseNotes
Expand Down

0 comments on commit 6b68244

Please sign in to comment.