Open emackey opened 6 years ago
@lexaknyazev Do you know how to interactively prompt the user for a bit of text input during a grind task? Specifically:
I'd like to prompt the user "Please enter your NPM 2FA code" and let them type what's typically a 6-digit string. It can be plain text entry; there's no need to conceal it like a normal password.
Then the next line would be something like:
run(npmExecutable, arguments: ['publish', '-otp=' + userOtp], workingDirectory: _nodeTarget);
This is partly blocked on upstream issue regarding forwarding stdin to spawned tasks. I'll update this issue as soon as it's unblocked.
I enabled 2FA on my npm account some weeks ago, I guess we haven't published the validator since then. Looks like we need to add a publish pre-step that asks for the OTP code and passes it on the command line with
--otp=<code>
(without the angle brackets). Note that this should be done just prior to the publish step, as the codes only last 60 seconds at most, and entering the code takes some of that time, so we wouldn't wantnpm install
or other pre-process steps in between the code entry and the publish command.In the meantime I've published
2.0.0-dev.2.5
by halting the script at this point and manually publishing.