fix: reporting with --loglevel=error (#9230)

This commit is contained in:
Zoltan Kochan
2025-03-07 02:25:50 +01:00
committed by GitHub
parent f62db6c736
commit 6f56790218
2 changed files with 14 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/default-reporter": patch
"pnpm": patch
---
When `--loglevel` is set to `error`, don't show installation summary, execution time, and big tarball download progress.

View File

@@ -111,12 +111,13 @@ export function reporterForClient (
outputs.push(reportContext(log$, { cwd }))
}
if (opts.cmd in PRINT_EXECUTION_TIME_IN_COMMANDS) {
outputs.push(reportExecutionTime(log$.executionTime))
}
// logLevelNumber: 0123 = error warn info debug
const logLevelNumber = LOG_LEVEL_NUMBER[opts.logLevel ?? 'info'] ?? LOG_LEVEL_NUMBER['info']
const showInfo = logLevelNumber >= LOG_LEVEL_NUMBER.info
if (opts.cmd in PRINT_EXECUTION_TIME_IN_COMMANDS && showInfo) {
outputs.push(reportExecutionTime(log$.executionTime))
}
if (logLevelNumber >= LOG_LEVEL_NUMBER.warn) {
outputs.push(
@@ -129,7 +130,7 @@ export function reporterForClient (
)
}
if (logLevelNumber >= LOG_LEVEL_NUMBER.info) {
if (showInfo) {
outputs.push(
reportProgress(log$, {
cwd,
@@ -147,11 +148,11 @@ export function reporterForClient (
)
}
if (!opts.appendOnly) {
if (!opts.appendOnly && showInfo) {
outputs.push(reportBigTarballProgress(log$))
}
if (!opts.isRecursive) {
if (!opts.isRecursive && showInfo) {
outputs.push(reportSummary(log$, {
cmd: opts.cmd,
cwd,