Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Show help on no command" #276

Merged
merged 1 commit into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions bin/webpack.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
"Controls the output of lifecycle messaging e.g. Started watching files..."
}
});

// yargs will terminate the process early when the user uses help or version.
// This causes large help outputs to be cut short (https://github.com/nodejs/node/wiki/API-changes-between-v0.10-and-v4#process).
// To prevent this we use the yargs.parse API and exit the process normally
Expand Down Expand Up @@ -464,12 +465,9 @@
if (err) {
lastHash = null;
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
process.exit(1);
if (err.details) console.error(err.details);
process.exit(1); // eslint-disable-line
}

if (outputOptions.json) {
stdout.write(
JSON.stringify(stats.toJson(outputOptions), null, 2) + "\n"
Expand All @@ -479,20 +477,10 @@
const statsString = stats.toString(outputOptions);
if (statsString) stdout.write(statsString + "\n");
}

if (!options.watch && stats.hasErrors()) {
process.exitCode = 2;

const fs = require("fs");
const context = stats.compilation.compiler.context;
const configPath = context + "/webpack.config.js";
const configMissing = !fs.existsSync(configPath);
if (yargs.argv._.length === 0 && configMissing) {
yargs.showHelp("log");
}
}
}

if (firstOptions.watch || options.watch) {
const watchOptions =
firstOptions.watchOptions ||
Expand All @@ -508,9 +496,7 @@
compiler.watch(watchOptions, compilerCallback);
if (outputOptions.infoVerbosity !== "none")
console.log("\nWebpack is watching the files…\n");
} else {
compiler.run(compilerCallback);
}
} else compiler.run(compilerCallback);
}

processOptions(options);
Expand Down
16 changes: 0 additions & 16 deletions test/binCases/help/help-output-no-command/stdin.js

This file was deleted.

Empty file.