diff --git a/lib/utils/read-user-info.js b/lib/utils/read-user-info.js index 26d5b36d55b58..1cac8ee6d2668 100644 --- a/lib/utils/read-user-info.js +++ b/lib/utils/read-user-info.js @@ -1,5 +1,4 @@ -const { promisify } = require('util') -const readAsync = promisify(require('read')) +const read = require('read') const userValidate = require('npm-user-validate') const log = require('./log-shim.js') @@ -17,9 +16,9 @@ const passwordPrompt = 'npm password: ' const usernamePrompt = 'npm username: ' const emailPrompt = 'email (this IS public): ' -function read (opts) { +function readWithProgress (opts) { log.clearProgress() - return readAsync(opts).finally(() => log.showProgress()) + return read(opts).finally(() => log.showProgress()) } function readOTP (msg = otpPrompt, otp, isRetry) { @@ -27,7 +26,7 @@ function readOTP (msg = otpPrompt, otp, isRetry) { return otp.replace(/\s+/g, '') } - return read({ prompt: msg, default: otp || '' }) + return readWithProgress({ prompt: msg, default: otp || '' }) .then((rOtp) => readOTP(msg, rOtp, true)) } @@ -36,7 +35,7 @@ function readPassword (msg = passwordPrompt, password, isRetry) { return password } - return read({ prompt: msg, silent: true, default: password || '' }) + return readWithProgress({ prompt: msg, silent: true, default: password || '' }) .then((rPassword) => readPassword(msg, rPassword, true)) } @@ -50,7 +49,7 @@ function readUsername (msg = usernamePrompt, username, isRetry) { } } - return read({ prompt: msg, default: username || '' }) + return readWithProgress({ prompt: msg, default: username || '' }) .then((rUsername) => readUsername(msg, rUsername, true)) } @@ -64,6 +63,6 @@ function readEmail (msg = emailPrompt, email, isRetry) { } } - return read({ prompt: msg, default: email || '' }) + return readWithProgress({ prompt: msg, default: email || '' }) .then((username) => readEmail(msg, username, true)) } diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 76e9c118ffaa2..6f37aae133b54 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -114,6 +114,10 @@ !/inherits !/ini !/init-package-json +!/init-package-json/node_modules/ +/init-package-json/node_modules/* +!/init-package-json/node_modules/mute-stream +!/init-package-json/node_modules/read !/ip-regex !/ip !/is-cidr @@ -227,6 +231,10 @@ !/promise-inflight !/promise-retry !/promzard +!/promzard/node_modules/ +/promzard/node_modules/* +!/promzard/node_modules/mute-stream +!/promzard/node_modules/read !/qrcode-terminal !/read-cmd-shim !/read-package-json-fast diff --git a/node_modules/init-package-json/node_modules/mute-stream/LICENSE b/node_modules/init-package-json/node_modules/mute-stream/LICENSE new file mode 100644 index 0000000000000..19129e315fe59 --- /dev/null +++ b/node_modules/init-package-json/node_modules/mute-stream/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/mute-stream/mute.js b/node_modules/init-package-json/node_modules/mute-stream/mute.js similarity index 100% rename from node_modules/mute-stream/mute.js rename to node_modules/init-package-json/node_modules/mute-stream/mute.js diff --git a/node_modules/init-package-json/node_modules/mute-stream/package.json b/node_modules/init-package-json/node_modules/mute-stream/package.json new file mode 100644 index 0000000000000..56ebb363b9251 --- /dev/null +++ b/node_modules/init-package-json/node_modules/mute-stream/package.json @@ -0,0 +1,29 @@ +{ + "name": "mute-stream", + "version": "0.0.8", + "main": "mute.js", + "directories": { + "test": "test" + }, + "devDependencies": { + "tap": "^12.1.1" + }, + "scripts": { + "test": "tap test/*.js --cov" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/mute-stream" + }, + "keywords": [ + "mute", + "stream", + "pipe" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "description": "Bytes go in, but they don't come out (when muted).", + "files": [ + "mute.js" + ] +} diff --git a/node_modules/init-package-json/node_modules/read/LICENSE b/node_modules/init-package-json/node_modules/read/LICENSE new file mode 100644 index 0000000000000..19129e315fe59 --- /dev/null +++ b/node_modules/init-package-json/node_modules/read/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/init-package-json/node_modules/read/lib/read.js b/node_modules/init-package-json/node_modules/read/lib/read.js new file mode 100644 index 0000000000000..a93d1b3b532c0 --- /dev/null +++ b/node_modules/init-package-json/node_modules/read/lib/read.js @@ -0,0 +1,113 @@ + +module.exports = read + +var readline = require('readline') +var Mute = require('mute-stream') + +function read (opts, cb) { + if (opts.num) { + throw new Error('read() no longer accepts a char number limit') + } + + if (typeof opts.default !== 'undefined' && + typeof opts.default !== 'string' && + typeof opts.default !== 'number') { + throw new Error('default value must be string or number') + } + + var input = opts.input || process.stdin + var output = opts.output || process.stdout + var prompt = (opts.prompt || '').trim() + ' ' + var silent = opts.silent + var editDef = false + var timeout = opts.timeout + + var def = opts.default || '' + if (def) { + if (silent) { + prompt += '(