Commit 97d0b97 authored and committed Oct 9, 2017
1 parent 6008ccf commit 97d0b97 Copy full SHA for 97d0b97
File tree 3 files changed +4
-2
lines changed
3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const chalk = importLazy('chalk');
9
9
const semverDiff = importLazy ( 'semver-diff' ) ;
10
10
const latestVersion = importLazy ( 'latest-version' ) ;
11
11
const isNpm = importLazy ( 'is-npm' ) ;
12
+ const isInstalledGlobally = importLazy ( 'is-installed-globally' ) ;
12
13
const boxen = importLazy ( 'boxen' ) ;
13
14
const xdgBasedir = importLazy ( 'xdg-basedir' ) ;
14
15
const ONE_DAY = 1000 * 60 * 60 * 24 ;
@@ -109,7 +110,7 @@ class UpdateNotifier {
109
110
return this ;
110
111
}
111
112
112
- opts = Object . assign ( { isGlobal : true } , opts ) ;
113
+ opts = Object . assign ( { isGlobal : isInstalledGlobally ( ) } , opts ) ;
113
114
114
115
opts . message = opts . message || 'Update available ' + chalk ( ) . dim ( this . update . current ) + chalk ( ) . reset ( ' → ' ) +
115
116
chalk ( ) . green ( this . update . latest ) + ' \nRun ' + chalk ( ) . cyan ( 'npm i ' + ( opts . isGlobal ? '-g ' : '' ) + this . packageName ) + ' to update' ;
Original file line number Diff line number Diff line change 37
37
"chalk" : " ^2.0.1" ,
38
38
"configstore" : " ^3.0.0" ,
39
39
"import-lazy" : " ^2.1.0" ,
40
+ "is-installed-globally" : " ^0.1.0" ,
40
41
"is-npm" : " ^1.0.0" ,
41
42
"latest-version" : " ^3.0.0" ,
42
43
"semver-diff" : " ^2.0.0" ,
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ test.afterEach(() => {
43
43
44
44
test ( 'use pretty boxen message by default' , t => {
45
45
const notifier = new Control ( ) ;
46
- notifier . notify ( { defer : false } ) ;
46
+ notifier . notify ( { defer : false , isGlobal : true } ) ;
47
47
48
48
t . is ( stripAnsi ( errorLogs ) , `
49
49
You can’t perform that action at this time.
0 commit comments