Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/commands/token.js')
-rw-r--r--deps/npm/lib/commands/token.js45
1 files changed, 20 insertions, 25 deletions
diff --git a/deps/npm/lib/commands/token.js b/deps/npm/lib/commands/token.js
index cf3b8cbee53..de8e61101d8 100644
--- a/deps/npm/lib/commands/token.js
+++ b/deps/npm/lib/commands/token.js
@@ -140,32 +140,27 @@ class Token extends BaseCommand {
const cidr = conf.cidr
const readonly = conf.readOnly
- return readUserInfo
- .password()
- .then(password => {
- const validCIDR = this.validateCIDRList(cidr)
- log.info('token', 'creating')
- return pulseTillDone.withPromise(
- otplease(this.npm, conf, conf => {
- return profile.createToken(password, readonly, validCIDR, conf)
- })
- )
- })
- .then(result => {
- delete result.key
- delete result.updated
- if (conf.json) {
- this.npm.output(JSON.stringify(result))
- } else if (conf.parseable) {
- Object.keys(result).forEach(k => this.npm.output(k + '\t' + result[k]))
- } else {
- const table = new Table()
- for (const k of Object.keys(result)) {
- table.push({ [chalk.bold(k)]: String(result[k]) })
- }
- this.npm.output(table.toString())
- }
+ const password = await readUserInfo.password()
+ const validCIDR = this.validateCIDRList(cidr)
+ log.info('token', 'creating')
+ const result = await pulseTillDone.withPromise(
+ otplease(this.npm, conf, conf => {
+ return profile.createToken(password, readonly, validCIDR, conf)
})
+ )
+ delete result.key
+ delete result.updated
+ if (conf.json) {
+ this.npm.output(JSON.stringify(result))
+ } else if (conf.parseable) {
+ Object.keys(result).forEach(k => this.npm.output(k + '\t' + result[k]))
+ } else {
+ const table = new Table()
+ for (const k of Object.keys(result)) {
+ table.push({ [chalk.bold(k)]: String(result[k]) })
+ }
+ this.npm.output(table.toString())
+ }
}
config () {