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

Fix publish otp for yarn berry #741

Merged
merged 3 commits into from Apr 7, 2024

Conversation

mifi
Copy link
Sponsor Contributor

@mifi mifi commented Apr 5, 2024

symptom: hangs forever here:

  ✔ Prerequisite check
  ✔ Git
  ✔ Installing dependencies using yarn-berry
  ✔ Running tests
  ✔ Bumping version
  ⠦ Publishing package

I aborted it and tried to run the command manually and I can see that it prompts for a OTP on stdout:

yarn npm publish
➤ YN0000: LICENSE
➤ YN0000: README.md
➤ YN0000: index.js
➤ YN0000: package.json
✖ One-time password: · 

Looking at the np otp implementation it seems that npm and yarn v1 will exit with an error when an OTP is encountered:

if (error.stderr.includes('one-time pass') || error.stdout.includes('Two factor authentication')) {

however yarn berry doesn't exit, it just prints the OTP prompt and hangs forever. this PR will help kill it off so that OTP can be prompted to the user and then re-run the cmd. not the cleanest but it works.

kind of related to #725

@sindresorhus
Copy link
Owner

CI is failing

@sindresorhus sindresorhus merged commit 02f60c7 into sindresorhus:main Apr 7, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants