Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,20 @@ class Init extends BaseCommand {
].join('\n'))
}

// XXX promisify init-package-json
await new Promise((res, rej) => {
initJson(path, initFile, this.npm.config, (er, data) => {
log.resume()
log.enableProgress()
log.silly('package data', data)
if (er && er.message === 'canceled') {
log.warn('init', 'canceled')
return res()
}
if (er) {
rej(er)
} else {
log.info('init', 'written successfully')
res(data)
}
})
})
try {
const data = await initJson(path, initFile, this.npm.config)
log.silly('package data', data)
return data
} catch (er) {
if (er.message === 'canceled') {
log.warn('init', 'canceled')
} else {
throw er
}
} finally {
log.resume()
log.enableProgress()
}
}

async setWorkspace (pkg, workspacePath) {
Expand Down
3 changes: 1 addition & 2 deletions lib/utils/read-user-info.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { promisify } = require('util')
const readAsync = promisify(require('read'))
const readAsync = require('read')
const userValidate = require('npm-user-validate')
const log = require('./log-shim.js')

Expand Down
Loading