fix(reporting): remove whiteBright highlighting (#9389)

This commit is contained in:
Nikita Prokopov
2025-04-08 18:41:26 +02:00
committed by GitHub
parent 6574546eee
commit 43bd37f504
5 changed files with 19 additions and 16 deletions

View File

@@ -0,0 +1,7 @@
---
"@pnpm/default-reporter": patch
"pnpm": patch
---
Removed bright white highlighting, which didn't look good on some light themes [#9389](https://github.com/pnpm/pnpm/pull/9389).

View File

@@ -3,7 +3,6 @@ import chalk from 'chalk'
export const PREFIX_MAX_LENGTH = 40
export const hlValue = chalk.cyanBright
export const hlPkgId = chalk['whiteBright']
export const ADDED_CHAR = chalk.green('+')
export const REMOVED_CHAR = chalk.red('-')

View File

@@ -3,7 +3,6 @@ import type * as Rx from 'rxjs'
import { filter, map, startWith } from 'rxjs/operators'
import prettyBytes from 'pretty-bytes'
import {
hlPkgId,
hlValue,
} from './outputConstants'
@@ -36,7 +35,7 @@ export function reportBigTarballProgress (
const downloaded = prettyBytes(downloadedRaw, PRETTY_OPTS)
return {
fixed: !done,
msg: `Downloading ${hlPkgId(startedLog['packageId'])}: ${hlValue(downloaded)}/${hlValue(size)}${done ? ', done' : ''}`,
msg: `Downloading ${startedLog['packageId']}: ${hlValue(downloaded)}/${hlValue(size)}${done ? ', done' : ''}`,
}
})
)

View File

@@ -8,7 +8,6 @@ import normalizeNewline from 'normalize-newline'
import { firstValueFrom } from 'rxjs'
const hlValue = chalk.cyanBright
const hlPkgId = chalk['whiteBright']
const POSTINSTALL = hlValue('postinstall')
const PREINSTALL = hlValue('preinstall')
@@ -1039,10 +1038,10 @@ test['skip']('prints lifecycle progress', async () => {
const output = await firstValueFrom(output$.pipe(skip(3), take(1), map(normalizeNewline)))
expect(output).toBe(`\
Running ${POSTINSTALL} for ${hlPkgId('registry.npmjs.org/foo/1.0.0')}: ${childOutputColor('foo I')}
Running ${POSTINSTALL} for ${hlPkgId('registry.npmjs.org/foo/1.0.0')}! ${childOutputError('foo II')}
Running ${POSTINSTALL} for ${hlPkgId('registry.npmjs.org/foo/1.0.0')}: ${childOutputColor('foo III')}
Running ${POSTINSTALL} for ${hlPkgId('registry.npmjs.org/bar/1.0.0')}: ${childOutputColor('bar I')}`)
Running ${POSTINSTALL} for registry.npmjs.org/foo/1.0.0: ${childOutputColor('foo I')}
Running ${POSTINSTALL} for registry.npmjs.org/foo/1.0.0! ${childOutputError('foo II')}
Running ${POSTINSTALL} for registry.npmjs.org/foo/1.0.0: ${childOutputColor('foo III')}
Running ${POSTINSTALL} for registry.npmjs.org/bar/1.0.0: ${childOutputColor('bar I')}`)
})
function failedAt (wd: string) {

View File

@@ -17,7 +17,6 @@ import normalizeNewline from 'normalize-newline'
import { formatWarn } from '../src/reporterForClient/utils/formatWarn'
const hlValue = chalk.cyanBright
const hlPkgId = chalk['whiteBright']
const EOL = '\n'
@@ -414,29 +413,29 @@ test('prints progress of big files download', async () => {
case 1:
expect(output).toBe(`\
Progress: resolved ${hlValue('1')}, reused ${hlValue('0')}, downloaded ${hlValue('0')}, added ${hlValue('0')}
Downloading ${hlPkgId(pkgId1)}: ${hlValue('0.00 B')}/${hlValue('10.49 MB')}`)
Downloading ${pkgId1}: ${hlValue('0.00 B')}/${hlValue('10.49 MB')}`)
return
case 2:
expect(output).toBe(`\
Progress: resolved ${hlValue('1')}, reused ${hlValue('0')}, downloaded ${hlValue('0')}, added ${hlValue('0')}
Downloading ${hlPkgId(pkgId1)}: ${hlValue('5.77 MB')}/${hlValue('10.49 MB')}`)
Downloading ${pkgId1}: ${hlValue('5.77 MB')}/${hlValue('10.49 MB')}`)
return
case 4:
expect(output).toBe(`\
Progress: resolved ${hlValue('2')}, reused ${hlValue('0')}, downloaded ${hlValue('0')}, added ${hlValue('0')}
Downloading ${hlPkgId(pkgId1)}: ${hlValue('7.34 MB')}/${hlValue('10.49 MB')}`)
Downloading ${pkgId1}: ${hlValue('7.34 MB')}/${hlValue('10.49 MB')}`)
return
case 7:
expect(output).toBe(`\
Progress: resolved ${hlValue('3')}, reused ${hlValue('0')}, downloaded ${hlValue('0')}, added ${hlValue('0')}
Downloading ${hlPkgId(pkgId1)}: ${hlValue('7.34 MB')}/${hlValue('10.49 MB')}
Downloading ${hlPkgId(pkgId3)}: ${hlValue('19.92 MB')}/${hlValue('20.97 MB')}`)
Downloading ${pkgId1}: ${hlValue('7.34 MB')}/${hlValue('10.49 MB')}
Downloading ${pkgId3}: ${hlValue('19.92 MB')}/${hlValue('20.97 MB')}`)
return
case 8:
expect(output).toBe(`\
Downloading ${hlPkgId(pkgId1)}: ${hlValue('10.49 MB')}/${hlValue('10.49 MB')}, done
Downloading ${pkgId1}: ${hlValue('10.49 MB')}/${hlValue('10.49 MB')}, done
Progress: resolved ${hlValue('3')}, reused ${hlValue('0')}, downloaded ${hlValue('0')}, added ${hlValue('0')}
Downloading ${hlPkgId(pkgId3)}: ${hlValue('19.92 MB')}/${hlValue('20.97 MB')}`)
Downloading ${pkgId3}: ${hlValue('19.92 MB')}/${hlValue('20.97 MB')}`)
return // eslint-disable-line
}
})