Skip to content

Commit 9123de4

Browse files
committedApr 16, 2024·
feat: do all ouput over proc-log events
1 parent 87f6c09 commit 9123de4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+646
-523
lines changed
 

‎lib/base-command.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { relative } = require('path')
44

55
const { definitions } = require('@npmcli/config/lib/definitions')
66
const { aliases: cmdAliases } = require('./utils/cmd-list')
7-
const { log } = require('proc-log')
7+
const { log, output } = require('proc-log')
88

99
class BaseCommand {
1010
static workspaces = false
@@ -119,7 +119,7 @@ class BaseCommand {
119119
const { config } = this.npm
120120

121121
if (config.get('usage')) {
122-
return this.npm.output(this.usage)
122+
return output.standard(this.usage)
123123
}
124124

125125
const hasWsConfig = config.get('workspaces') || config.get('workspace').length

‎lib/cli-entry.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = async (process, validateEngines) => {
1818
exitHandler.setNpm(npm)
1919

2020
// only log node and npm paths in argv initially since argv can contain sensitive info. a cleaned version will be logged later
21-
const { log } = require('proc-log')
21+
const { log, output } = require('proc-log')
2222
log.verbose('cli', process.argv.slice(0, 2).join(' '))
2323
log.info('using', 'npm@%s', npm.version)
2424
log.info('using', 'node@%s', process.version)
@@ -41,7 +41,7 @@ module.exports = async (process, validateEngines) => {
4141

4242
// npm -v
4343
if (npm.config.get('version', 'cli')) {
44-
npm.output(npm.version)
44+
output.standard(npm.version)
4545
return exitHandler()
4646
}
4747

@@ -53,7 +53,7 @@ module.exports = async (process, validateEngines) => {
5353

5454
cmd = npm.argv.shift()
5555
if (!cmd) {
56-
npm.output(npm.usage)
56+
output.standard(npm.usage)
5757
process.exitCode = 1
5858
return exitHandler()
5959
}
@@ -64,8 +64,8 @@ module.exports = async (process, validateEngines) => {
6464
if (err.code === 'EUNKNOWNCOMMAND') {
6565
const didYouMean = require('./utils/did-you-mean.js')
6666
const suggestions = await didYouMean(npm.localPrefix, cmd)
67-
npm.output(`Unknown command: "${cmd}"${suggestions}\n`)
68-
npm.output('To see a list of supported npm commands, run:\n npm help')
67+
output.standard(`Unknown command: "${cmd}"${suggestions}\n`)
68+
output.standard('To see a list of supported npm commands, run:\n npm help')
6969
process.exitCode = 1
7070
return exitHandler()
7171
}

0 commit comments

Comments
 (0)
Please sign in to comment.