Skip to content

Commit

Permalink
Implement feedback
Browse files Browse the repository at this point in the history
- Rename `validateWebpackOptions` -> `validationSchema`
- Export `WebpackOptionsValidationError` on webpack.
  • Loading branch information
SpaceK33z committed Nov 2, 2016
1 parent 2bbd365 commit 985a651
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion bin/convert-argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fs.existsSync = fs.existsSync || path.existsSync;
var resolve = require("enhanced-resolve");
var interpret = require("interpret");
var WebpackOptionsDefaulter = require("../lib/WebpackOptionsDefaulter");
var validateWebpackOptions = require("../lib/validateWebpackOptions");

module.exports = function(yargs, argv, convertOptions) {

Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions lib/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ var MultiCompiler = require("./MultiCompiler");
var NodeEnvironmentPlugin = require("./node/NodeEnvironmentPlugin");
var WebpackOptionsApply = require("./WebpackOptionsApply");
var WebpackOptionsDefaulter = require("./WebpackOptionsDefaulter");
var validateWebpackOptions = require("./validateWebpackOptions");
var validationSchema = require("./validationSchema");
var WebpackOptionsValidationError = require("./WebpackOptionsValidationError");
var webpackOptionsSchema = require("../schemas/webpackOptionsSchema.json");

function webpack(options, callback) {
var webpackOptionsValidationErrors = validateWebpackOptions(webpackOptionsSchema, options);
var webpackOptionsValidationErrors = validationSchema(webpackOptionsSchema, options);
if(webpackOptionsValidationErrors.length) {
throw new WebpackOptionsValidationError(webpackOptionsValidationErrors);
}
Expand Down Expand Up @@ -53,8 +53,9 @@ webpack.WebpackOptionsApply = WebpackOptionsApply;
webpack.Compiler = Compiler;
webpack.MultiCompiler = MultiCompiler;
webpack.NodeEnvironmentPlugin = NodeEnvironmentPlugin;
webpack.validate = validateWebpackOptions.bind(this, webpackOptionsSchema);
webpack.validateSchema = validateWebpackOptions;
webpack.validate = validationSchema.bind(this, webpackOptionsSchema);
webpack.validateSchema = validationSchema;
webpack.WebpackOptionsValidationError = WebpackOptionsValidationError;

function exportPlugins(exports, path, plugins) {
plugins.forEach(function(name) {
Expand Down

0 comments on commit 985a651

Please sign in to comment.