main
js 24 lines 545 Bytes
Raw
1 #!/usr/bin/env node
2 /**
3 * Copyright (c) Meta Platforms, Inc. and affiliates.
4 *
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9 const prompt = require('prompt-promise');
10
11 const run = async () => {
12 while (true) {
13 const otp = await prompt('NPM 2-factor auth code: ');
14 prompt.done();
15 if (otp) {
16 return otp;
17 } else {
18 console.error('\nTwo-factor auth is required to publish.');
19 // (Ask again.)
20 }
21 }
22 };
23
24 module.exports = run;