mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-12 02:57:44 -04:00
fix(reporter): always print the final progress stats
This commit is contained in:
5
.changeset/small-rivers-run.md
Normal file
5
.changeset/small-rivers-run.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/default-reporter": patch
|
||||
---
|
||||
|
||||
Always print the final progress stats.
|
||||
@@ -54,7 +54,7 @@ export default function (
|
||||
const width = opts.width ?? process.stdout.columns ?? 80
|
||||
const cwd = opts.pnpmConfig?.dir ?? process.cwd()
|
||||
const throttle = typeof opts.throttleProgress === 'number' && opts.throttleProgress > 0
|
||||
? throttleTime(opts.throttleProgress)
|
||||
? throttleTime(opts.throttleProgress, undefined, { leading: true, trailing: true })
|
||||
: undefined
|
||||
|
||||
const outputs: Array<Rx.Observable<Rx.Observable<{msg: string}>>> = [
|
||||
|
||||
@@ -53,18 +53,17 @@ function throttledProgressOutput (
|
||||
importingDone$: Rx.Observable<boolean>,
|
||||
progress$: Rx.Observable<ProgressStats>
|
||||
) {
|
||||
// Reporting is done every `throttleProgress` milliseconds
|
||||
// and once all packages are fetched.
|
||||
return Rx.combineLatest(
|
||||
throttle ? progress$.pipe(throttle) : progress$,
|
||||
let combinedProgress = Rx.combineLatest(
|
||||
progress$,
|
||||
importingDone$
|
||||
)
|
||||
.pipe(
|
||||
map(createStatusMessage),
|
||||
// Avoid logs after all resolved packages were downloaded.
|
||||
// Fixing issue: https://github.com/pnpm/pnpm/issues/1028#issuecomment-364782901
|
||||
takeWhile((msg) => msg['done'] !== true, true)
|
||||
)
|
||||
// Avoid logs after all resolved packages were downloaded.
|
||||
// Fixing issue: https://github.com/pnpm/pnpm/issues/1028#issuecomment-364782901
|
||||
.pipe(takeWhile(([, importingDone]) => !importingDone, true))
|
||||
if (throttle) {
|
||||
combinedProgress = combinedProgress.pipe(throttle)
|
||||
}
|
||||
return combinedProgress.pipe(map(createStatusMessage))
|
||||
}
|
||||
|
||||
function getModulesInstallProgress$ (
|
||||
|
||||
Reference in New Issue
Block a user