From c5a800cb77a7303330460383eb8d6b0f8a2e1148 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Mon, 25 Mar 2019 23:28:37 -0500 Subject: [PATCH] New: Tailor message when local gulp is missing (#155) --- index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index bc1a1c31..686583df 100644 --- a/index.js +++ b/index.js @@ -147,11 +147,23 @@ function handleArguments(env) { } if (!env.modulePath) { + var missingNodeModules = + fs.existsSync(path.join(env.cwd, 'package.json')) + && !fs.existsSync(path.join(env.cwd, 'node_modules')); + + var missingGulpMessage = + missingNodeModules + ? 'Local modules not found in' + : 'Local gulp not found in'; log.error( - ansi.red('Local gulp not found in'), + ansi.red(missingGulpMessage), ansi.magenta(tildify(env.cwd)) ); - log.error(ansi.red('Try running: npm install gulp')); + var installCommand = + missingNodeModules + ? 'npm install' + : 'npm install gulp'; + log.error(ansi.red('Try running: ' + installCommand)); exit(1); }