File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 4141 "detect-port-alt" : " 1.1.3" ,
4242 "escape-string-regexp" : " 1.0.5" ,
4343 "filesize" : " 3.3.0" ,
44+ "global-modules" : " 1.0.0" ,
4445 "gzip-size" : " 3.0.0" ,
4546 "html-entities" : " 1.2.1" ,
4647 "inquirer" : " 3.1.1" ,
Original file line number Diff line number Diff line change 1111
1212const chalk = require ( 'chalk' ) ;
1313const url = require ( 'url' ) ;
14+ const globalModules = require ( 'global-modules' ) ;
15+ const fs = require ( 'fs' ) ;
1416
1517function printHostingInstructions (
1618 appPackage ,
@@ -121,10 +123,12 @@ function printHostingInstructions(
121123 ) ;
122124 console . log ( 'You may serve it with a static server:' ) ;
123125 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+ }
128132 }
129133 console . log ( ` ${ chalk . cyan ( 'serve' ) } -s ${ buildFolder } ` ) ;
130134 console . log ( ) ;
You can’t perform that action at this time.
0 commit comments