Skip to content

Commit c3bd10e

Browse files
committed
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
1 parent 3ecf19c commit c3bd10e

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

lib/utils/update-notifier.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ const updateNotifier = async (npm, spec = 'latest') => {
111111
`${oldc} -> ${latestc}\n` +
112112
`Changelog: ${changelogc}\n` +
113113
`Run ${cmdc} to update!\n`
114-
const messagec = !useColor ? message : chalk.bgBlack.white(message)
115114

116-
return messagec
115+
return message
117116
}
118117

119118
// only update the notification timeout if we actually finished checking

tap-snapshots/test/lib/utils/update-notifier.js.test.cjs

+30-30
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
*/
77
'use strict'
88
exports[`test/lib/utils/update-notifier.js TAP notification situations major to current > color 1`] = `
9-
[40m[37m[39m[49m
10-
[40m[37mNew [31mmajor[39m[37m version of npm available! [31m122.420.69[39m[37m -> [32m123.420.69[39m[37m[39m[49m
11-
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m[37m[39m[49m
12-
[40m[37mRun [32mnpm install -g [email protected][39m[37m to update![39m[49m
13-
[40m[37m[39m[49m
9+
10+
New [31mmajor[39m version of npm available! [31m122.420.69[39m -> [32m123.420.69[39m
11+
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v123.420.69[39m
12+
Run [32mnpm install -g [email protected][39m to update!
13+
1414
`
1515

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

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

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

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

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

5656
exports[`test/lib/utils/update-notifier.js TAP notification situations new beta available > color 1`] = `
57-
[40m[37m[39m[49m
58-
[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
59-
[40m[37mChangelog: [36mhttps://github.com/npm/cli/releases/tag/v124.0.0-beta.99999[39m[37m[39m[49m
60-
[40m[37mRun [32mnpm install -g [email protected][39m[37m to update![39m[49m
61-
[40m[37m[39m[49m
57+
58+
New [32mprerelease[39m version of npm available! [31m124.0.0-beta.0[39m -> [32m124.0.0-beta.99999[39m
59+
Changelog: [36mhttps://github.com/npm/cli/releases/tag/v124.0.0-beta.99999[39m
60+
Run [32mnpm install -g [email protected][39m to update!
61+
6262
`
6363

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

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

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

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

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

0 commit comments

Comments
 (0)