@@ -20,18 +20,25 @@ const resolveSchema = schema => {
20
20
const findPropertyInSchema = ( schema , property , subProperty ) => {
21
21
if ( ! schema ) return null ;
22
22
if ( subProperty ) {
23
- if ( schema [ property ] && typeof schema [ property ] === "object" && subProperty in schema [ property ] ) {
23
+ if (
24
+ schema [ property ] &&
25
+ typeof schema [ property ] === "object" &&
26
+ subProperty in schema [ property ]
27
+ ) {
24
28
return resolveSchema ( schema [ property ] [ subProperty ] ) ;
25
29
}
26
30
} else {
27
- if ( property in schema )
28
- return resolveSchema ( schema [ property ] ) ;
31
+ if ( property in schema ) return resolveSchema ( schema [ property ] ) ;
29
32
}
30
33
for ( const name of nestedProperties ) {
31
34
if ( schema [ name ] ) {
32
35
for ( const item of schema [ name ] ) {
33
36
const resolvedItem = resolveSchema ( item ) ;
34
- const result = findPropertyInSchema ( resolvedItem , property , subProperty ) ;
37
+ const result = findPropertyInSchema (
38
+ resolvedItem ,
39
+ property ,
40
+ subProperty
41
+ ) ;
35
42
if ( result ) return result ;
36
43
}
37
44
}
@@ -44,7 +51,9 @@ const getSchemaInfo = (path, property, subProperty) => {
44
51
let current = optionsSchema ;
45
52
for ( const segment of pathSegments ) {
46
53
if ( segment === "*" ) {
47
- current = findPropertyInSchema ( current , "additionalProperties" ) || findPropertyInSchema ( current , "items" ) ;
54
+ current =
55
+ findPropertyInSchema ( current , "additionalProperties" ) ||
56
+ findPropertyInSchema ( current , "items" ) ;
48
57
} else {
49
58
current = findPropertyInSchema ( current , "properties" , segment ) ;
50
59
}
@@ -147,46 +156,40 @@ module.exports = function(yargs) {
147
156
} ,
148
157
"output-filename" : {
149
158
type : "string" ,
150
- describe :
151
- getSchemaInfo ( "output.filename" , "description" ) ,
159
+ describe : getSchemaInfo ( "output.filename" , "description" ) ,
152
160
group : OUTPUT_GROUP ,
153
161
defaultDescription : "[name].js" ,
154
162
requiresArg : true
155
163
} ,
156
164
"output-chunk-filename" : {
157
165
type : "string" ,
158
- describe :
159
- getSchemaInfo ( "output.chunkFilename" , "description" ) ,
166
+ describe : getSchemaInfo ( "output.chunkFilename" , "description" ) ,
160
167
group : OUTPUT_GROUP ,
161
168
defaultDescription :
162
169
"filename with [id] instead of [name] or [id] prefixed" ,
163
170
requiresArg : true
164
171
} ,
165
172
"output-source-map-filename" : {
166
173
type : "string" ,
167
- describe :
168
- getSchemaInfo ( "output.sourceMapFilename" , "description" ) ,
174
+ describe : getSchemaInfo ( "output.sourceMapFilename" , "description" ) ,
169
175
group : OUTPUT_GROUP ,
170
176
requiresArg : true
171
177
} ,
172
178
"output-public-path" : {
173
179
type : "string" ,
174
- describe :
175
- getSchemaInfo ( "output.publicPath" , "description" ) ,
180
+ describe : getSchemaInfo ( "output.publicPath" , "description" ) ,
176
181
group : OUTPUT_GROUP ,
177
182
requiresArg : true
178
183
} ,
179
184
"output-jsonp-function" : {
180
185
type : "string" ,
181
- describe :
182
- getSchemaInfo ( "output.jsonpFunction" , "description" ) ,
186
+ describe : getSchemaInfo ( "output.jsonpFunction" , "description" ) ,
183
187
group : OUTPUT_GROUP ,
184
188
requiresArg : true
185
189
} ,
186
190
"output-pathinfo" : {
187
191
type : "boolean" ,
188
- describe :
189
- getSchemaInfo ( "output.pathinfo" , "description" ) ,
192
+ describe : getSchemaInfo ( "output.pathinfo" , "description" ) ,
190
193
group : OUTPUT_GROUP
191
194
} ,
192
195
"output-library" : {
@@ -197,8 +200,7 @@ module.exports = function(yargs) {
197
200
} ,
198
201
"output-library-target" : {
199
202
type : "string" ,
200
- describe :
201
- getSchemaInfo ( "output.libraryTarget" , "description" ) ,
203
+ describe : getSchemaInfo ( "output.libraryTarget" , "description" ) ,
202
204
choices : getSchemaInfo ( "output.libraryTarget" , "enum" ) ,
203
205
group : OUTPUT_GROUP ,
204
206
requiresArg : true
@@ -249,22 +251,18 @@ module.exports = function(yargs) {
249
251
"watch-stdin" : {
250
252
type : "boolean" ,
251
253
alias : "stdin" ,
252
- describe :
253
- getSchemaInfo ( "watchOptions.stdin" , "description" ) ,
254
+ describe : getSchemaInfo ( "watchOptions.stdin" , "description" ) ,
254
255
group : ADVANCED_GROUP
255
256
} ,
256
257
"watch-aggregate-timeout" : {
257
- describe :
258
- getSchemaInfo ( "watchOptions.aggregateTimeout" , "description" ) ,
259
- type :
260
- getSchemaInfo ( "watchOptions.aggregateTimeout" , "type" ) ,
258
+ describe : getSchemaInfo ( "watchOptions.aggregateTimeout" , "description" ) ,
259
+ type : getSchemaInfo ( "watchOptions.aggregateTimeout" , "type" ) ,
261
260
group : ADVANCED_GROUP ,
262
261
requiresArg : true
263
262
} ,
264
263
"watch-poll" : {
265
264
type : "string" ,
266
- describe :
267
- getSchemaInfo ( "watchOptions.poll" , "description" ) ,
265
+ describe : getSchemaInfo ( "watchOptions.poll" , "description" ) ,
268
266
group : ADVANCED_GROUP
269
267
} ,
270
268
hot : {
@@ -285,15 +283,13 @@ module.exports = function(yargs) {
285
283
} ,
286
284
"resolve-alias" : {
287
285
type : "string" ,
288
- describe :
289
- getSchemaInfo ( "resolve.alias" , "description" ) ,
286
+ describe : getSchemaInfo ( "resolve.alias" , "description" ) ,
290
287
group : RESOLVE_GROUP ,
291
288
requiresArg : true
292
289
} ,
293
290
"resolve-extensions" : {
294
291
type : "array" ,
295
- describe :
296
- getSchemaInfo ( "resolve.alias" , "description" ) ,
292
+ describe : getSchemaInfo ( "resolve.alias" , "description" ) ,
297
293
group : RESOLVE_GROUP ,
298
294
requiresArg : true
299
295
} ,
@@ -309,15 +305,16 @@ module.exports = function(yargs) {
309
305
requiresArg : true
310
306
} ,
311
307
"optimize-min-chunk-size" : {
312
- describe :
313
- getSchemaInfo ( "optimization.splitChunks.minSize" , "description" ) ,
308
+ describe : getSchemaInfo (
309
+ "optimization.splitChunks.minSize" ,
310
+ "description"
311
+ ) ,
314
312
group : OPTIMIZE_GROUP ,
315
313
requiresArg : true
316
314
} ,
317
315
"optimize-minimize" : {
318
316
type : "boolean" ,
319
- describe :
320
- getSchemaInfo ( "optimization.minimize" , "description" ) ,
317
+ describe : getSchemaInfo ( "optimization.minimize" , "description" ) ,
321
318
group : OPTIMIZE_GROUP
322
319
} ,
323
320
prefetch : {
0 commit comments