Skip to content

Commit

Permalink
feature(defaults): remove entry and output.path validation (#217)
Browse files Browse the repository at this point in the history
* feat(defaults): remove validations from entry and output.path

* feat(defaults): bump optional dependency to alpha.1

* add comma to pkg.json and update yarn
  • Loading branch information
TheLarkInn authored and evenstensberg committed Dec 16, 2017
1 parent 3a49e16 commit a8da6b4
Show file tree
Hide file tree
Showing 3 changed files with 230 additions and 95 deletions.
47 changes: 0 additions & 47 deletions bin/convert-argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,35 +554,6 @@ module.exports = function(yargs, argv, convertOptions) {

mapArgToBoolean("profile");

if (noOutputFilenameDefined) {
ensureObject(options, "output");
if (convertOptions && convertOptions.outputFilename) {
options.output.path = path.resolve(
path.dirname(convertOptions.outputFilename)
);
options.output.filename = path.basename(convertOptions.outputFilename);
} else if (argv._.length > 0) {
options.output.filename = argv._.pop();
options.output.path = path.resolve(
path.dirname(options.output.filename)
);
options.output.filename = path.basename(options.output.filename);
} else if (configFileLoaded) {
throw new Error(
"'output.filename' is required, either in config file or as --output-filename"
);
} else {
console.error(
"No configuration file found and no output filename configured via CLI option."
);
console.error(
"A configuration file could be named 'webpack.config.js' in the current directory."
);
console.error("Use --help to display the CLI options.");
process.exit(-1); // eslint-disable-line
}
}

if (argv._.length > 0) {
if (Array.isArray(options.entry) || typeof options.entry === "string") {
options.entry = {
Expand Down Expand Up @@ -621,23 +592,5 @@ module.exports = function(yargs, argv, convertOptions) {
}
});
}

if (!options.entry) {
if (configFileLoaded) {
console.error("Configuration file found but no entry configured.");
} else {
console.error(
"No configuration file found and no entry configured via CLI option."
);
console.error(
"When using the CLI you need to provide at least two arguments: entry and output."
);
console.error(
"A configuration file could be named 'webpack.config.js' in the current directory."
);
}
console.error("Use --help to display the CLI options.");
process.exit(-1); // eslint-disable-line
}
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
},
"optionalDependencies": {
"schema-utils": "^0.4.2",
"webpack": "^4.0.0-alpha.0",
"webpack": "^4.0.0-alpha.1",
"webpack-dev-server": "^2.9.7"
}
}
Loading

0 comments on commit a8da6b4

Please sign in to comment.