@@ -158,7 +158,8 @@ function build(previousSizeMap) {
158
158
console . log ( ) ;
159
159
160
160
var openCommand = process . platform === 'win32' ? 'start' : 'open' ;
161
- var homepagePath = require ( paths . appPackageJson ) . homepage ;
161
+ var appPackage = require ( paths . appPackageJson ) ;
162
+ var homepagePath = appPackage . homepage ;
162
163
var publicPath = config . output . publicPath ;
163
164
if ( homepagePath && homepagePath . indexOf ( '.github.io/' ) !== - 1 ) {
164
165
// "homepage": "http://user.github.io/project"
@@ -167,23 +168,26 @@ function build(previousSizeMap) {
167
168
console . log ( ) ;
168
169
console . log ( 'The ' + chalk . cyan ( 'build' ) + ' folder is ready to be deployed.' ) ;
169
170
console . log ( 'To publish it at ' + chalk . green ( homepagePath ) + ', run:' ) ;
170
- console . log ( ) ;
171
- if ( useYarn ) {
172
- console . log ( ' ' + chalk . cyan ( 'yarn' ) + ' add --dev gh-pages' ) ;
173
- } else {
174
- console . log ( ' ' + chalk . cyan ( 'npm' ) + ' install --save-dev gh-pages' ) ;
171
+ // If script deploy has been added to package.json, skip the instructions
172
+ if ( typeof appPackage . scripts . deploy === 'undefined' ) {
173
+ console . log ( ) ;
174
+ if ( useYarn ) {
175
+ console . log ( ' ' + chalk . cyan ( 'yarn' ) + ' add --dev gh-pages' ) ;
176
+ } else {
177
+ console . log ( ' ' + chalk . cyan ( 'npm' ) + ' install --save-dev gh-pages' ) ;
178
+ }
179
+ console . log ( ) ;
180
+ console . log ( 'Add the following script in your ' + chalk . cyan ( 'package.json' ) + '.' ) ;
181
+ console . log ( ) ;
182
+ console . log ( ' ' + chalk . dim ( '// ...' ) ) ;
183
+ console . log ( ' ' + chalk . yellow ( '"scripts"' ) + ': {' ) ;
184
+ console . log ( ' ' + chalk . dim ( '// ...' ) ) ;
185
+ console . log ( ' ' + chalk . yellow ( '"deploy"' ) + ': ' + chalk . yellow ( '"npm run build&&gh-pages -d build"' ) ) ;
186
+ console . log ( ' }' ) ;
187
+ console . log ( ) ;
188
+ console . log ( 'Then run:' ) ;
175
189
}
176
190
console . log ( ) ;
177
- console . log ( 'Add the following script in your ' + chalk . cyan ( 'package.json' ) + '.' ) ;
178
- console . log ( ) ;
179
- console . log ( ' ' + chalk . dim ( '// ...' ) ) ;
180
- console . log ( ' ' + chalk . yellow ( '"scripts"' ) + ': {' ) ;
181
- console . log ( ' ' + chalk . dim ( '// ...' ) ) ;
182
- console . log ( ' ' + chalk . yellow ( '"deploy"' ) + ': ' + chalk . yellow ( '"npm run build&&gh-pages -d build"' ) ) ;
183
- console . log ( ' }' ) ;
184
- console . log ( ) ;
185
- console . log ( 'Then run:' ) ;
186
- console . log ( ) ;
187
191
console . log ( ' ' + chalk . cyan ( useYarn ? 'yarn' : 'npm' ) + ' run deploy' ) ;
188
192
console . log ( ) ;
189
193
} else if ( publicPath !== '/' ) {
0 commit comments