Skip to content

Commit e726667

Browse files
committed
Merge branch 'master' of github.com:facebookincubator/create-react-app into react-dev-utils/babel
2 parents 7d3146b + 3690495 commit e726667

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/react-dev-utils/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"detect-port-alt": "1.1.3",
4848
"escape-string-regexp": "1.0.5",
4949
"filesize": "3.3.0",
50+
"global-modules": "1.0.0",
5051
"gzip-size": "3.0.0",
5152
"html-entities": "1.2.1",
5253
"inquirer": "3.1.1",

packages/react-dev-utils/src/printHostingInstructions.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
const chalk = require('chalk');
1313
const url = require('url');
14+
const globalModules = require('global-modules');
15+
const fs = require('fs');
1416

1517
function 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();

0 commit comments

Comments
 (0)