File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 MIT License http://www.opensource.org/licenses/mit-license.php
55 Author Tobias Koppers @sokra
66*/
7-
7+ require ( "v8-compile-cache" ) ;
88var resolveCwd = require ( "resolve-cwd" ) ;
99// Local version replace global one
1010var 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 {
293293 pluginsSchemaPath . indexOf ( "optimize" ) >= 0
294294 ? "webpack.optimize"
295295 : "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+
299315 return this . prompt ( [
300316 List (
301317 "pluginsPropType" ,
302318 `What property do you want to add ${ pluginExist } ?` ,
303- pluginSchema
319+ pluginsSchemaProps
304320 )
305321 ] ) . then ( pluginsPropAnswer => {
306322 return this . prompt ( [
Original file line number Diff line number Diff line change 6767 "recast" : " ^0.13.0" ,
6868 "resolve-cwd" : " ^2.0.0" ,
6969 "supports-color" : " ^4.4.0" ,
70+ "v8-compile-cache" : " ^1.1.0" ,
7071 "webpack-addons" : " ^1.1.5" ,
7172 "yargs" : " ^9.0.1" ,
7273 "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:
59325932 version "3.1.0"
59335933 resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
59345934
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+
59355939v8flags@^2.1.1 :
59365940 version "2.1.1"
59375941 resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"
You can’t perform that action at this time.
0 commit comments