8000 Fix specifying a custom version via UI (#546) · JavaScriptExpert/np@6b68244 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b68244

Browse files
authored
Fix specifying a custom version via UI (sindresorhus#546)
1 parent add34d2 commit 6b68244

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

source/ui.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ module.exports = async (options, pkg) => {
8585
},
8686
{
8787
type: 'input',
88-
name: 'version',
88+
name: 'customVersion',
8989
message: 'Version',
9090
when: answers => !answers.version,
9191
filter: input => version.isValidInput(input) ? version(pkg.version).getNewVersionFrom(input) : input,
@@ -105,7 +105,7 @@ module.exports = async (options, pkg) => {
105105
type: 'list',
106106
name: 'tag',
107107
message: 'How should this pre-release version be tagged in npm?',
108-
when: answers => options.runPublish && version.isPrereleaseOrIncrement(answers.version) && !options.tag,
108+
when: answers => options.runPublish && (version.isPrereleaseOrIncrement(answers.customVersion) || version.isPrereleaseOrIncrement(answers.version)) && !options.tag,
109109
choices: async () => {
110110
const existingPrereleaseTags = await prereleaseTags(pkg.name);
111111

@@ -121,9 +121,9 @@ module.exports = async (options, pkg) => {
121121
},
122122
{
123123
type: 'input',
124-
name: 'tag',
124+
name: 'customTag',
125125
message: 'Tag',
126-
when: answers => options.runPublish && version.isPrereleaseOrIncrement(answers.version) && !options.tag && !answers.tag,
126+
when: answers => options.runPublish && (version.isPrereleaseOrIncrement(answers.customVersion) || version.isPrereleaseOrIncrement(answers.version)) && !options.tag && !answers.tag,
127127
validate: input => {
128128
if (input.length === 0) {
129129
return 'Please specify a tag, for example, `next`.';
@@ -193,7 +193,8 @@ module.exports = async (options, pkg) => {
193193

194194
return {
195195
...options,
196-
...answers,
196+
version: answers.version || answers.customVersion,
197+
tag: answers.tag || answers.customTag,
197198
confirm: true,
198199
repoUrl,
199200
releaseNotes

0 commit comments

Comments
 (0)
0