@@ -388,13 +388,15 @@ class WebpackCLI implements IWebpackCLI {
388388 } ,
389389 ] ,
390390 description : "To get the output in a specified format ( accept json or markdown )" ,
391+ helpLevel : "minimum" ,
391392 } ,
392393 {
393394 name : "additional-package" ,
394395 alias : "a" ,
395396 configs : [ { type : "string" } ] ,
396397 multiple : true ,
397398 description : "Adds additional packages to the output" ,
399+ helpLevel : "minimum" ,
398400 } ,
399401 ] ;
400402 }
@@ -810,6 +812,7 @@ class WebpackCLI implements IWebpackCLI {
810812 ] ,
811813 multiple : true ,
812814 description : "Provide path to a webpack configuration file e.g. ./webpack.config.js." ,
815+ helpLevel : "minimum" ,
813816 } ,
814817 {
815818 name : "config-name" ,
@@ -820,6 +823,7 @@ class WebpackCLI implements IWebpackCLI {
820823 ] ,
821824 multiple : true ,
822825 description : "Name of the configuration to use." ,
826+ helpLevel : "minimum" ,
823827 } ,
824828 {
825829 name : "merge" ,
@@ -831,6 +835,7 @@ class WebpackCLI implements IWebpackCLI {
831835 } ,
832836 ] ,
833837 description : "Merge two or more configurations using 'webpack-merge'." ,
838+ helpLevel : "minimum" ,
834839 } ,
835840 {
836841 name : "disable-interpret" ,
@@ -841,6 +846,7 @@ class WebpackCLI implements IWebpackCLI {
841846 } ,
842847 ] ,
843848 description : "Disable interpret for loading the config file." ,
849+ helpLevel : "minimum" ,
844850 } ,
845851 // Complex configs
846852 {
@@ -888,6 +894,7 @@ class WebpackCLI implements IWebpackCLI {
888894 } ,
889895 multiple : true ,
890896 description : "Environment passed to the configuration when it is a function." ,
897+ helpLevel : "minimum" ,
891898 } ,
892899 {
893900 name : "node-env" ,
@@ -898,6 +905,7 @@ class WebpackCLI implements IWebpackCLI {
898905 ] ,
899906 multiple : false ,
900907 description : "Sets process.env.NODE_ENV to the specified value." ,
908+ helpLevel : "minimum" ,
901909 } ,
902910 {
903911 name : "define-process-env-node-env" ,
@@ -909,6 +917,7 @@ class WebpackCLI implements IWebpackCLI {
909917 multiple : false ,
910918 description :
911919 "Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`)" ,
920+ helpLevel : "minimum" ,
912921 } ,
913922
914923 // Adding more plugins
@@ -922,6 +931,7 @@ class WebpackCLI implements IWebpackCLI {
922931 ] ,
923932 multiple : false ,
924933 description : "It invokes webpack-bundle-analyzer plugin to get bundle information." ,
934+ helpLevel : "minimum" ,
925935 } ,
926936 {
927937 name : "progress" ,
@@ -935,6 +945,7 @@ class WebpackCLI implements IWebpackCLI {
935945 } ,
936946 ] ,
937947 description : "Print compilation progress during build." ,
948+ helpLevel : "minimum" ,
938949 } ,
939950
940951 // Output options
@@ -951,6 +962,7 @@ class WebpackCLI implements IWebpackCLI {
951962 ] ,
952963 alias : "j" ,
953964 description : "Prints result as JSON or store it in a file." ,
965+ helpLevel : "minimum" ,
954966 } ,
955967 {
956968 name : "fail-on-warnings" ,
@@ -961,11 +973,11 @@ class WebpackCLI implements IWebpackCLI {
961973 } ,
962974 ] ,
963975 description : "Stop webpack-cli process with non-zero exit code on warnings from webpack" ,
976+ helpLevel : "minimum" ,
964977 } ,
965978 ] ;
966979
967980 const minimumHelpFlags = [
968- ...builtInFlags . map ( ( flag ) => flag . name ) ,
969981 "mode" ,
970982 "watch" ,
971983 "watch-options-stdin" ,
@@ -979,37 +991,18 @@ class WebpackCLI implements IWebpackCLI {
979991
980992 // Extract all the flags being exported from core.
981993 // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/main/test/__snapshots__/Cli.basictest.js.snap
982- const coreArguments = Object . entries ( this . webpack . cli . getArguments ( ) ) . map ( ( [ flag , meta ] ) => {
983- const inBuiltIn = builtInFlags . find ( ( builtInFlag ) => builtInFlag . name === flag ) ;
984-
985- if ( inBuiltIn ) {
986- return {
987- ...meta ,
988- // @ts -expect-error this might be overwritten
989- name : flag ,
990- group : "core" ,
991- ...inBuiltIn ,
992- configs : meta . configs || [ ] ,
993- } ;
994- }
995-
996- return { ...meta , name : flag , group : "core" } ;
997- } ) ;
998-
999- const options : WebpackCLIBuiltInOption [ ] = ( [ ] as WebpackCLIBuiltInFlag [ ] )
1000- . concat (
1001- builtInFlags . filter (
1002- ( builtInFlag ) =>
1003- ! coreArguments . find ( ( coreArgument ) => builtInFlag . name === coreArgument . name ) ,
1004- ) ,
1005- )
1006- . concat ( coreArguments )
1007- . map ( ( option ) : WebpackCLIBuiltInOption => {
1008- ( option as WebpackCLIBuiltInOption ) . helpLevel = minimumHelpFlags . includes ( option . name )
1009- ? "minimum"
1010- : "verbose" ;
1011- return option as WebpackCLIBuiltInOption ;
1012- } ) ;
994+ const options = builtInFlags . concat (
995+ Object . entries ( this . webpack . cli . getArguments ( ) ) . map < WebpackCLIBuiltInOption > (
996+ ( [ name , meta ] ) => {
997+ return {
998+ ...meta ,
999+ name,
1000+ group : "core" ,
1001+ helpLevel : minimumHelpFlags . includes ( name ) ? "minimum" : "verbose" ,
1002+ } ;
1003+ } ,
1004+ ) ,
1005+ ) ;
10131006
10141007 this . builtInOptionsCache = options ;
10151008
0 commit comments