Skip to content

Commit

Permalink
Don't prompt to install serve if already installed (#2761)
Browse files Browse the repository at this point in the history
* dont prompt if serve is already installed

* change name for readability

* Pin the version
  • Loading branch information
sven3270350 committed Jul 10, 2017
1 parent b664c0c commit 2e73fa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/react-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"detect-port-alt": "1.1.3",
"escape-string-regexp": "1.0.5",
"filesize": "3.3.0",
"global-modules": "1.0.0",
"gzip-size": "3.0.0",
"html-entities": "1.2.1",
"inquirer": "3.1.1",
Expand Down
12 changes: 8 additions & 4 deletions packages/react-dev-utils/printHostingInstructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

const chalk = require('chalk');
const url = require('url');
const globalModules = require('global-modules');
const fs = require('fs');

function printHostingInstructions(
appPackage,
Expand Down Expand Up @@ -121,10 +123,12 @@ function printHostingInstructions(
);
console.log('You may serve it with a static server:');
console.log();
if (useYarn) {
console.log(` ${chalk.cyan('yarn')} global add serve`);
} else {
console.log(` ${chalk.cyan('npm')} install -g serve`);
if (!fs.existsSync(`${globalModules}/serve`)) {
if (useYarn) {
console.log(` ${chalk.cyan('yarn')} global add serve`);
} else {
console.log(` ${chalk.cyan('npm')} install -g serve`);
}
}
console.log(` ${chalk.cyan('serve')} -s ${buildFolder}`);
console.log();
Expand Down

0 comments on commit 2e73fa7

Please sign in to comment.