Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(update-notifier): don't force black background
This looks very wrong on white terminals.

npmlog still makes its `notice` logs do this but that will have to be
fixed in the npmlog repo.

PR-URL: #3499
Credit: @wraithgar
Close: #3499
Reviewed-by: @nlf
  • Loading branch information
wraithgar committed Jul 12, 2021
1 parent 3ecf19c commit c3bd10e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
3 changes: 1 addition & 2 deletions lib/utils/update-notifier.js
Expand Up @@ -111,9 +111,8 @@ const updateNotifier = async (npm, spec = 'latest') => {
`${oldc} -> ${latestc}\n` +
`Changelog: ${changelogc}\n` +
`Run ${cmdc} to update!\n`
const messagec = !useColor ? message : chalk.bgBlack.white(message)

return messagec
return message
}

// only update the notification timeout if we actually finished checking
Expand Down
60 changes: 30 additions & 30 deletions tap-snapshots/test/lib/utils/update-notifier.js.test.cjs
Expand Up @@ -6,11 +6,11 @@
*/
'use strict'
exports[`test/lib/utils/update-notifier.js TAP notification situations major to current > color 1`] = `
[40m[37m[39m[49m
[40m[37mNew [31mmajor[39m[37m version of npm available! [31m122.420.69[39m[37m -> [32m123.420.69[39m[37m[39m[49m
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m[37m[39m[49m
[40m[37mRun [32mnpm install -g npm@123.420.69[39m[37m to update![39m[49m
[40m[37m[39m[49m
New [31mmajor[39m version of npm available! [31m122.420.69[39m -> [32m123.420.69[39m
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m
Run [32mnpm install -g npm@123.420.69[39m to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations major to current > no color 1`] = `
Expand All @@ -22,11 +22,11 @@ Run \`npm install -g npm@123.420.69\` to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations minor to current > color 1`] = `
[40m[37m[39m[49m
[40m[37mNew [33mminor[39m[37m version of npm available! [31m123.419.69[39m[37m -> [32m123.420.69[39m[37m[39m[49m
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m[37m[39m[49m
[40m[37mRun [32mnpm install -g npm@123.420.69[39m[37m to update![39m[49m
[40m[37m[39m[49m
New [33mminor[39m version of npm available! [31m123.419.69[39m -> [32m123.420.69[39m
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m
Run [32mnpm install -g npm@123.420.69[39m to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations minor to current > no color 1`] = `
Expand All @@ -38,11 +38,11 @@ Run \`npm install -g npm@123.420.69\` to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations minor to next version > color 1`] = `
[40m[37m[39m[49m
[40m[37mNew [33mminor[39m[37m version of npm available! [31m123.420.70[39m[37m -> [32m123.421.70[39m[37m[39m[49m
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v123.421.70[39m[37m[39m[49m
[40m[37mRun [32mnpm install -g npm@123.421.70[39m[37m to update![39m[49m
[40m[37m[39m[49m
New [33mminor[39m version of npm available! [31m123.420.70[39m -> [32m123.421.70[39m
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v123.421.70[39m
Run [32mnpm install -g npm@123.421.70[39m to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations minor to next version > no color 1`] = `
Expand All @@ -54,11 +54,11 @@ Run \`npm install -g npm@123.421.70\` to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations new beta available > color 1`] = `
[40m[37m[39m[49m
[40m[37mNew [32mprerelease[39m[37m version of npm available! [31m124.0.0-beta.0[39m[37m -> [32m124.0.0-beta.99999[39m[37m[39m[49m
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v124.0.0-beta.99999[39m[37m[39m[49m
[40m[37mRun [32mnpm install -g npm@124.0.0-beta.99999[39m[37m to update![39m[49m
[40m[37m[39m[49m
New [32mprerelease[39m version of npm available! [31m124.0.0-beta.0[39m -> [32m124.0.0-beta.99999[39m
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v124.0.0-beta.99999[39m
Run [32mnpm install -g npm@124.0.0-beta.99999[39m to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations new beta available > no color 1`] = `
Expand All @@ -70,11 +70,11 @@ Run \`npm install -g npm@124.0.0-beta.99999\` to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations patch to current > color 1`] = `
[40m[37m[39m[49m
[40m[37mNew [32mpatch[39m[37m version of npm available! [31m123.420.68[39m[37m -> [32m123.420.69[39m[37m[39m[49m
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m[37m[39m[49m
[40m[37mRun [32mnpm install -g npm@123.420.69[39m[37m to update![39m[49m
[40m[37m[39m[49m
New [32mpatch[39m version of npm available! [31m123.420.68[39m -> [32m123.420.69[39m
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m
Run [32mnpm install -g npm@123.420.69[39m to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations patch to current > no color 1`] = `
Expand All @@ -86,11 +86,11 @@ Run \`npm install -g npm@123.420.69\` to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations patch to next version > color 1`] = `
[40m[37m[39m[49m
[40m[37mNew [32mpatch[39m[37m version of npm available! [31m123.421.69[39m[37m -> [32m123.421.70[39m[37m[39m[49m
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v123.421.70[39m[37m[39m[49m
[40m[37mRun [32mnpm install -g npm@123.421.70[39m[37m to update![39m[49m
[40m[37m[39m[49m
New [32mpatch[39m version of npm available! [31m123.421.69[39m -> [32m123.421.70[39m
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v123.421.70[39m
Run [32mnpm install -g npm@123.421.70[39m to update!
`

exports[`test/lib/utils/update-notifier.js TAP notification situations patch to next version > no color 1`] = `
Expand Down

0 comments on commit c3bd10e

Please sign in to comment.