-
Notifications
You must be signed in to change notification settings - Fork 118
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
Check if 2FA is enabled in verifyConditions #11
Comments
It only works if you enabled 2fa with |
Yes, we are aware of the problem. There is not much we can do, besides setting the The problem is that if you enable 2FA without it, you cannot automate the release of your packages, which renders semantic-release pretty useless. I wonder if we can somehow check for that and give a good, explanatory error message ... could you find that out? That’d be super helpful :) |
Yeah, just run
|
The challenge is that The the check would have to be done only when the repo is I don't know how to write unit tests to verify it works... |
Something like this should catch it let stdout
try {
stdout = await exec('npm profile get "two factor auth"')
} catch {
// ignore
}
if (stdout.trim() === 'auth-and-writes') {
throw new Error('Your two-factor authentication is set to auth-and-writes. To publish packages automatically, please set it to auth-only')
} |
Yes that's a good idea. But how would you write unit tests? |
Unit test is simple, stub |
Ok. Would you like to try a PR? Ultimately, I'd like to have an integration test solution that works like the real registry. But so far I couldn't find what npm use to handles tokens. |
I don't know if this is an npm issue, but my publishes fail since I enabled 2FA. I wanted others to be aware of this
npm 5.5.1
The text was updated successfully, but these errors were encountered: