You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off: thanks a ton for your work on this really awesome tool 🦄 💜.
Problem
I'm currently running into a problem when trying to a problem when trying to specify a custom version (like v1.0.0.beta) via the interactive UI: Selecting Other (specify) does not show the successive prompt to input the version number string. The release process then fails with an error, since the version number is blank.
The explicit error varies for npm and yarn, but the core problem is the same: they are missing the version number to update to. Here two examples of the error messages:
yarn
click here to expand example
✖ Command failed with exit code 1: yarn version --new-version
error Invalid version supplied.
info Current version: 3.0.0
info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
error Command failed with exit code 1.
npm
click here to expand example
```
✖ Command failed with exit code 1: npm version
npm ERR! npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=] | from-git]
npm ERR! (run in package dir)
npm ERR! 'npm -v' or 'npm --version' to print npm version (6.13.7)
npm ERR! 'npm view version' to view a package's published version
npm ERR! 'npm ls' to inspect current package/dependency versions
error Command failed with exit code 1.
```
Cause
The interactive UI skips showing the next input even though the version is not specified yet and instead continues with the next step.
The next step fails due to the version still being blank, which according to this line would normally have been the condition to actually show the prompt for inputting a custom version 🤔.
Scenarios
I run into this scenario regardless of using npm or yarn, zsh or bash and regardless of "how" I execute np:
in a release script command defned in my package.json
directly calling yarn np or node_modules/.bin/np
from a shell script
The behavior is the same for versions v6.2.3, v6.0.0 and v5.1.1(I did not try other versions as I felt the problem is probably somewhere on my side).
Question
Am I using the tool wrong? I need to produce versions with names like e.g. v3.2.0beta and would ideally want to do this via the interactive UI 🤔.
Steps to reproduce
Here are the steps for a minimal example to reproduce this problem (also available as gist):
Option 1: Steps as a script:
click here for script 👩💻
#!/bin/shset -o errexit
set -o nounset
# Create directory
mkdir example &&cd example
# Initialize Git repository
git init && git commit --allow-empty -m "init commit"# Create bare bones `yarn` project with `np`
yarn init -y && yarn add -D np
# Commit everything (for simplicity)
git add --all && git commit -m "all"# Run `np` and select `Other (specify)` for the version
yarn np --any-branch --no-tests --no-cleanup --no-release-draft --no-publish
The output of the failing command looks approximately like this:
click here for output
? Select semver increment or specify new version Other (specify)
✔ Git
✖ Bumping version using Yarn
→ info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
Pushing tags
✖ Command failed with exit code 1: yarn version --new-version
error Invalid version supplied.
info Current version: 1.0.0
info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
The behavior I would expect from reading the code in ui.js would be to show a second input to type in the custom version number after selecting Other (specify) in the interactive UI.
The issue is reproducible everywhere we run with np but since the inquirer code looked good, it was difficult to understand what was causing the said issue.
Ended up creating demo projects and trying different combinations of inquirer prompts to see what was going on.
Turns out that the issue was caused just above this line because of us using the same name field for multiple prompts. We had version repeating twice, and tag repeating twice in the name field for prompts which unfortunately meant that inquirer skipped over the second of these names.
Fix was simple enough, use different names and finally map everything to the same name which we could then use throughout our whole program.
Description
Hi 👋
First off: thanks a ton for your work on this really awesome tool 🦄 💜.
Problem
I'm currently running into a problem when trying to a problem when trying to specify a custom version (like
v1.0.0.beta
) via the interactive UI: SelectingOther (specify)
does not show the successive prompt to input the version number string. The release process then fails with an error, since the version number is blank.The explicit error varies for
npm
andyarn
, but the core problem is the same: they are missing the version number to update to. Here two examples of the error messages:yarn
click here to expand example
npm
click here to expand example
``` ✖ Command failed with exit code 1: npm version npm ERR! npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=] | from-git] npm ERR! (run in package dir) npm ERR! 'npm -v' or 'npm --version' to print npm version (6.13.7) npm ERR! 'npm view version' to view a package's published version npm ERR! 'npm ls' to inspect current package/dependency versions error Command failed with exit code 1. ```Cause
The interactive UI skips showing the next input even though the
version
is not specified yet and instead continues with the next step.The next step fails due to the
version
still being blank, which according to this line would normally have been the condition to actually show the prompt for inputting a custom version 🤔.Scenarios
I run into this scenario regardless of using
npm
oryarn
,zsh
orbash
and regardless of "how" I executenp
:release
script command defned in mypackage.json
yarn np
ornode_modules/.bin/np
The behavior is the same for versions
v6.2.3
,v6.0.0
andv5.1.1
(I did not try other versions as I felt the problem is probably somewhere on my side).Question
Am I using the tool wrong? I need to produce versions with names like e.g.
v3.2.0beta
and would ideally want to do this via the interactive UI 🤔.Steps to reproduce
Here are the steps for a minimal example to reproduce this problem (also available as gist):
Option 1: Steps as a script:
click here for script 👩💻
Option 2: Steps as a individual steps:
Click here for steps 👨💻
Create directory:
Initialize Git repository:
Create bare bones
yarn
project:Install
np
:Commit everything (for simplicity):
Run
np
and selectOther (specify)
for the version:The output of the failing command looks approximately like this:
click here for output
Expected behavior
The behavior I would expect from reading the code in ui.js would be to show a second input to type in the custom version number after selecting
Other (specify)
in the interactive UI.Environment
np - 6.2.3
Node.js - 14.2.0
npm - 6.14.4
Git - 2.26.2
OS - macOS 10.15.4
The text was updated successfully, but these errors were encountered: