mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-24 08:35:19 -04:00
feat: don't show all the stderr output
Many libs use stderr for logging
This commit is contained in:
14
src/index.ts
14
src/index.ts
@@ -163,22 +163,14 @@ export function toOutput$(streamParser: object): Stream<string> {
|
||||
})
|
||||
.map(xs.of)
|
||||
|
||||
const lifecycleMessages: {[pkgId: string]: {keep: boolean, output: string}} = {}
|
||||
const lifecycleMessages: {[pkgId: string]: string} = {}
|
||||
const lifecycleOutput$ = xs.of(
|
||||
log$
|
||||
.filter((log) => log.name === 'pnpm:lifecycle')
|
||||
.map((log: LifecycleLog) => {
|
||||
const key = `${log.script}:${log.pkgId}`
|
||||
const keep = lifecycleMessages[key] && lifecycleMessages[key].keep || log.level === 'error'
|
||||
const formattedLine = formatLifecycle(log)
|
||||
const output = keep && lifecycleMessages[key]
|
||||
? `${lifecycleMessages[key].output}${EOL}${formattedLine}`
|
||||
: formattedLine
|
||||
lifecycleMessages[key] = {
|
||||
keep,
|
||||
output,
|
||||
}
|
||||
return R.values(lifecycleMessages).map((lm) => lm['output']).join(EOL)
|
||||
lifecycleMessages[key] = formatLifecycle(log)
|
||||
return R.values(lifecycleMessages).join(EOL)
|
||||
})
|
||||
.map((msg) => ({msg})),
|
||||
)
|
||||
|
||||
@@ -299,7 +299,8 @@ test('groups lifecycle output', t => {
|
||||
})
|
||||
})
|
||||
|
||||
test('prints lifecycle progress', t => {
|
||||
// Many libs use stderr for logging, so showing all stderr adds not much value
|
||||
test['skip']('prints lifecycle progress', t => {
|
||||
const output$ = toOutput$(createStreamParser())
|
||||
|
||||
const pkgId = 'registry.npmjs.org/foo/1.0.0'
|
||||
|
||||
Reference in New Issue
Block a user