File tree 4 files changed +26
-5
lines changed
4 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 4
4
MIT License http://www.opensource.org/licenses/mit-license.php
5
5
Author Tobias Koppers @sokra
6
6
*/
7
-
7
+ require ( "v8-compile-cache" ) ;
8
8
var resolveCwd = require ( "resolve-cwd" ) ;
9
9
// Local version replace global one
10
10
var localCLI = resolveCwd . silent ( "webpack-cli/bin/webpack" ) ;
Original file line number Diff line number Diff line change @@ -293,14 +293,30 @@ module.exports = class AddGenerator extends Generator {
293
293
pluginsSchemaPath . indexOf ( "optimize" ) >= 0
294
294
? "webpack.optimize"
295
295
: "webpack" ;
296
- const pluginSchema = Object . keys (
297
- require ( path . resolve ( pluginsSchemaPath ) ) . properties
298
- ) . map ( p => p ) ;
296
+ const resolvePluginsPath = path . resolve ( pluginsSchemaPath ) ;
297
+ const pluginSchema = resolvePluginsPath
298
+ ? require ( resolvePluginsPath )
299
+ : null ;
300
+ let pluginsSchemaProps = [ "other" ] ;
301
+ if ( pluginSchema ) {
302
+ Object . keys ( pluginSchema )
303
+ . filter ( p => Array . isArray ( pluginSchema [ p ] ) )
304
+ . forEach ( p => {
305
+ Object . keys ( pluginSchema [ p ] ) . forEach ( n => {
306
+ if ( pluginSchema [ p ] [ n ] . properties ) {
307
+ pluginsSchemaProps = Object . keys (
308
+ pluginSchema [ p ] [ n ] . properties
309
+ ) ;
310
+ }
311
+ } ) ;
312
+ } ) ;
313
+ }
314
+
299
315
return this . prompt ( [
300
316
List (
301
317
"pluginsPropType" ,
302
318
`What property do you want to add ${ pluginExist } ?` ,
303
- pluginSchema
319
+ pluginsSchemaProps
304
320
)
305
321
] ) . then ( pluginsPropAnswer => {
306
322
return this . prompt ( [
Original file line number Diff line number Diff line change 67
67
"recast" : " ^0.13.0" ,
68
68
"resolve-cwd" : " ^2.0.0" ,
69
69
"supports-color" : " ^4.4.0" ,
70
+ "v8-compile-cache" : " ^1.1.0" ,
70
71
"webpack-addons" : " ^1.1.5" ,
71
72
"yargs" : " ^9.0.1" ,
72
73
"yeoman-environment" : " ^2.0.0" ,
Original file line number Diff line number Diff line change @@ -5932,6 +5932,10 @@ uuid@^3.0.0, uuid@^3.1.0:
5932
5932
version "3.1.0"
5933
5933
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
5934
5934
5935
+ v8-compile-cache@^1.1.0 :
5936
+ version "1.1.0"
5937
+ resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-1.1.0.tgz#1dc2a340fb8e5f800a32bcdbfb8c23cd747021b9"
5938
+
5935
5939
v8flags@^2.1.1 :
5936
5940
version "2.1.1"
5937
5941
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"
You can’t perform that action at this time.
0 commit comments