feat(reporting): an option for hiding lifecycle output (#6979)

This commit is contained in:
Zoltan Kochan
2023-08-22 21:34:10 +03:00
committed by GitHub
parent e0474bc4c3
commit fe322b6781
3 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/default-reporter": minor
---
New option added: hideLifecycleOutput.

View File

@@ -26,6 +26,7 @@ export function initDefaultReporter (
outputMaxWidth?: number
hideAddedPkgsProgress?: boolean
hideProgressPrefix?: boolean
hideLifecycleOutput?: boolean
}
context: {
argv: string[]
@@ -107,6 +108,7 @@ export function toOutput$ (
throttleProgress?: number
hideAddedPkgsProgress?: boolean
hideProgressPrefix?: boolean
hideLifecycleOutput?: boolean
}
context: {
argv: string[]
@@ -266,6 +268,7 @@ export function toOutput$ (
width: opts.reportingOptions?.outputMaxWidth,
hideAddedPkgsProgress: opts.reportingOptions?.hideAddedPkgsProgress,
hideProgressPrefix: opts.reportingOptions?.hideProgressPrefix ?? (cmd === 'dlx'),
hideLifecycleOutput: opts.reportingOptions?.hideLifecycleOutput,
}
)

View File

@@ -68,6 +68,7 @@ export function reporterForClient (
width?: number
hideAddedPkgsProgress?: boolean
hideProgressPrefix?: boolean
hideLifecycleOutput?: boolean
}
): Array<Rx.Observable<Rx.Observable<{ msg: string }>>> {
const width = opts.width ?? process.stdout.columns ?? 80
@@ -78,7 +79,7 @@ export function reporterForClient (
const outputs: Array<Rx.Observable<Rx.Observable<{ msg: string }>>> = [
reportLifecycleScripts(log$, {
appendOnly: opts.appendOnly === true || opts.streamLifecycleOutput,
appendOnly: (opts.appendOnly === true || opts.streamLifecycleOutput) && !opts.hideLifecycleOutput,
aggregateOutput: opts.aggregateOutput,
cwd,
width,