File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 47
47
"detect-port-alt" : " 1.1.3" ,
48
48
"escape-string-regexp" : " 1.0.5" ,
49
49
"filesize" : " 3.3.0" ,
50
+ "global-modules" : " 1.0.0" ,
50
51
"gzip-size" : " 3.0.0" ,
51
52
"html-entities" : " 1.2.1" ,
52
53
"inquirer" : " 3.1.1" ,
Original file line number Diff line number Diff line change 11
11
12
12
const chalk = require ( 'chalk' ) ;
13
13
const url = require ( 'url' ) ;
14
+ const globalModules = require ( 'global-modules' ) ;
15
+ const fs = require ( 'fs' ) ;
14
16
15
17
function printHostingInstructions (
16
18
appPackage ,
@@ -121,10 +123,12 @@ function printHostingInstructions(
121
123
) ;
122
124
console . log ( 'You may serve it with a static server:' ) ;
123
125
console . log ( ) ;
124
- if ( useYarn ) {
125
- console . log ( ` ${ chalk . cyan ( 'yarn' ) } global add serve` ) ;
126
- } else {
127
- console . log ( ` ${ chalk . cyan ( 'npm' ) } install -g serve` ) ;
126
+ if ( ! fs . existsSync ( `${ globalModules } /serve` ) ) {
127
+ if ( useYarn ) {
128
+ console . log ( ` ${ chalk . cyan ( 'yarn' ) } global add serve` ) ;
129
+ } else {
130
+ console . log ( ` ${ chalk . cyan ( 'npm' ) } install -g serve` ) ;
131
+ }
128
132
}
129
133
console . log ( ` ${ chalk . cyan ( 'serve' ) } -s ${ buildFolder } ` ) ;
130
134
console . log ( ) ;
You can’t perform that action at this time.
0 commit comments