File tree 4 files changed +34
-17
lines changed
4 files changed +34
-17
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,8 @@ const fs = require("fs");
3
3
fs . existsSync = fs . existsSync || path . existsSync ;
4
4
const interpret = require ( "interpret" ) ;
5
5
const prepareOptions = require ( "./prepareOptions" ) ;
6
- const webpackConfigurationSchema = require ( "../config/webpackConfigurationSchema.json" ) ;
7
- const validateSchema = require ( "webpack" ) . validateSchema ;
8
6
const findup = require ( "findup-sync" ) ;
7
+ const validateOptions = require ( "./validate-options" ) ;
9
8
10
9
module . exports = function ( ...args ) {
11
10
const argv = args [ 1 ] || args [ 0 ] ;
@@ -136,21 +135,7 @@ module.exports = function(...args) {
136
135
137
136
function processConfiguredOptions ( options ) {
138
137
if ( options ) {
139
- let error ;
140
- try {
141
- const errors = validateSchema ( webpackConfigurationSchema , options ) ;
142
- if ( errors && errors . length > 0 ) {
143
- const { WebpackOptionsValidationError } = require ( "webpack" ) ;
144
- error = new WebpackOptionsValidationError ( errors ) ;
145
- }
146
- } catch ( err ) {
147
- error = err ;
148
- }
149
-
150
- if ( error ) {
151
- console . error ( error . message ) ;
152
- process . exit ( - 1 ) ;
153
- }
138
+ validateOptions ( options ) ;
154
139
} else {
155
140
options = { } ;
156
141
}
Original file line number Diff line number Diff line change
1
+ const webpackConfigurationSchema = require ( "../config/webpackConfigurationSchema.json" ) ;
2
+ const validateSchema = require ( "webpack" ) . validateSchema ;
3
+
4
+ module . exports = function validateOptions ( options ) {
5
+ let error ;
6
+ try {
7
+ const errors = validateSchema ( webpackConfigurationSchema , options ) ;
8
+ if ( errors && errors . length > 0 ) {
9
+ const { WebpackOptionsValidationError } = require ( "webpack" ) ;
10
+ error = new WebpackOptionsValidationError ( errors ) ;
11
+ }
12
+ } catch ( err ) {
13
+ error = err ;
14
+ }
15
+
16
+ if ( error ) {
17
+ console . error ( error . message ) ;
18
+ process . exit ( - 1 ) ;
19
+ }
20
+ } ;
Original file line number Diff line number Diff line change 143
143
"babel-preset-jest" : " 24.6.0" ,
144
144
"codecov" : " 3.5.0" ,
145
145
"commitizen" : " 4.0.3" ,
146
+ "commitlint" : " ^8.1.0" ,
146
147
"commitlint-config-cz" : " 0.12.0" ,
147
148
"conventional-changelog-cli" : " 2.0.21" ,
148
149
"cz-customizable" : " 6.2.0" ,
You can’t perform that action at this time.
0 commit comments