Skip to content

Commit c5a800c

Browse files
bdukesphated
authored andcommitted
New: Tailor message when local gulp is missing (#155)
1 parent 927e055 commit c5a800c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,23 @@ function handleArguments(env) {
147147
}
148148

149149
if (!env.modulePath) {
150+
var missingNodeModules =
151+
fs.existsSync(path.join(env.cwd, 'package.json'))
152+
&& !fs.existsSync(path.join(env.cwd, 'node_modules'));
153+
154+
var missingGulpMessage =
155+
missingNodeModules
156+
? 'Local modules not found in'
157+
: 'Local gulp not found in';
150158
log.error(
151-
ansi.red('Local gulp not found in'),
159+
ansi.red(missingGulpMessage),
152160
ansi.magenta(tildify(env.cwd))
153161
);
154-
log.error(ansi.red('Try running: npm install gulp'));
162+
var installCommand =
163+
missingNodeModules
164+
? 'npm install'
165+
: 'npm install gulp';
166+
log.error(ansi.red('Try running: ' + installCommand));
155167
exit(1);
156168
}
157169

0 commit comments

Comments
 (0)