Commit 36904959 authored by Owen Flood's avatar Owen Flood Committed by Dan Abramov
Browse files

Don't prompt to install serve if already installed (#2761)

* dont prompt if serve is already installed

* change name for readability

* Pin the version
parent 3ca6bae2
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 9 additions and 4 deletions
+9 -4
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
"detect-port-alt": "1.1.3", "detect-port-alt": "1.1.3",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
"filesize": "3.3.0", "filesize": "3.3.0",
"global-modules": "1.0.0",
"gzip-size": "3.0.0", "gzip-size": "3.0.0",
"html-entities": "1.2.1", "html-entities": "1.2.1",
"inquirer": "3.1.1", "inquirer": "3.1.1",
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
const chalk = require('chalk'); const chalk = require('chalk');
const url = require('url'); const url = require('url');
const globalModules = require('global-modules');
const fs = require('fs');
function printHostingInstructions( function printHostingInstructions(
appPackage, appPackage,
...@@ -121,10 +123,12 @@ function printHostingInstructions( ...@@ -121,10 +123,12 @@ function printHostingInstructions(
); );
console.log('You may serve it with a static server:'); console.log('You may serve it with a static server:');
console.log(); console.log();
if (useYarn) { if (!fs.existsSync(`${globalModules}/serve`)) {
console.log(` ${chalk.cyan('yarn')} global add serve`); if (useYarn) {
} else { console.log(` ${chalk.cyan('yarn')} global add serve`);
console.log(` ${chalk.cyan('npm')} install -g serve`); } else {
console.log(` ${chalk.cyan('npm')} install -g serve`);
}
} }
console.log(` ${chalk.cyan('serve')} -s ${buildFolder}`); console.log(` ${chalk.cyan('serve')} -s ${buildFolder}`);
console.log(); console.log();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment