@@ -16,50 +16,91 @@ try {
16
16
var Server = require ( "../lib/Server" ) ;
17
17
var webpack = require ( "webpack" ) ;
18
18
19
- var optimist = require ( "optimist" )
20
-
21
- . usage ( "webpack-dev-server " + require ( "../package.json" ) . version + "\n" +
22
- "Usage: http://webpack.github.io/docs/webpack-dev-server.html" )
23
-
24
- . boolean ( "lazy" ) . describe ( "lazy" )
25
-
26
- . boolean ( "stdin" ) . describe ( "stdin" , "close when stdin ends" )
27
-
28
- . boolean ( "info" ) . describe ( "info" ) . default ( "info" , true )
29
-
30
- . boolean ( "quiet" ) . describe ( "quiet" )
31
-
32
- . boolean ( "inline" ) . describe ( "inline" , "Inline the webpack-dev-server logic into the bundle." )
33
-
34
- . boolean ( "https" ) . describe ( "https" )
35
-
36
- . string ( "key" ) . describe ( "key" , "Path to a SSL key." )
37
-
38
- . string ( "cert" ) . describe ( "cert" , "Path to a SSL certificate." )
39
-
40
- . string ( "cacert" ) . describe ( "cacert" , "Path to a SSL CA certificate." )
41
-
42
- . string ( "content-base" ) . describe ( "content-base" , "A directory or URL to serve HTML content from." )
43
-
44
- . string ( "content-base-target" ) . describe ( "content-base-target" , "Proxy requests to this target." )
45
-
46
- . boolean ( "history-api-fallback" ) . describe ( "history-api-fallback" , "Fallback to /index.html for Single Page Applications." )
47
-
48
- . boolean ( "compress" ) . describe ( "compress" , "enable gzip compression" )
49
-
50
- . boolean ( "open" ) . describe ( "open" , "Open default browser" )
51
-
52
- . describe ( "port" , "The port" ) . default ( "port" , 8080 )
53
-
54
- . describe ( "public" , "The public hostname/ip address of the server" )
55
-
56
- . describe ( "host" , "The hostname/ip address the server will bind to" ) . default ( "host" , "localhost" ) ;
57
-
58
- require ( "webpack/bin/config-optimist" ) ( optimist ) ;
19
+ var yargs = require ( "yargs" )
20
+ . usage ( "webpack-dev-server " + require ( "../package.json" ) . version + "\n" +
21
+ "Usage: http://webpack.github.io/docs/webpack-dev-server.html" ) ;
22
+
23
+ require ( "webpack/bin/config-yargs" ) ( yargs ) ;
24
+
25
+ var DISPLAY_GROUP = "Stats options:" ;
26
+ var SSL_GROUP = "SSL options:" ;
27
+ var CONNECTION_GROUP = "Connection options:" ;
28
+ var RESPONSE_GROUP = "Response options:" ;
29
+
30
+ yargs . options ( {
31
+ "lazy" : {
32
+ type : "boolean"
33
+ } ,
34
+ "stdin" : {
35
+ type : "boolean" ,
36
+ describe : "close when stdin ends"
37
+ } ,
38
+ "open" : {
39
+ type : "boolean" ,
40
+ describe : "Open default browser"
41
+ } ,
42
+ "info" : {
43
+ type : "boolean" ,
44
+ group : DISPLAY_GROUP
45
+ } ,
46
+ "quiet" : {
47
+ type : "boolean" ,
48
+ group : DISPLAY_GROUP
49
+ } ,
50
+ "https" : {
51
+ type : "boolean" ,
52
+ group : SSL_GROUP
53
+ } ,
54
+ "key" : {
55
+ type : "string" ,
56
+ describe : "Path to a SSL key." ,
57
+ group : SSL_GROUP
58
+ } ,
59
+ "cert" : {
60
+ type : "string" ,
61
+ describe : "Path to a SSL certificate." ,
62
+ group : SSL_GROUP
63
+ } ,
64
+ "cacert" : {
65
+ type : "string" ,
66
+ describe : "Path to a SSL CA certificate." ,
67
+ group : SSL_GROUP
68
+ } ,
69
+ "content-base" : {
70
+ type : "string" ,
71
+ describe : "A directory or URL to serve HTML content from." ,
72
+ group : RESPONSE_GROUP
73
+ } ,
74
+ "history-api-fallback" : {
75
+ type : "boolean" ,
76
+ describe : "Fallback to /index.html for Single Page Applications." ,
77
+ group : RESPONSE_GROUP
78
+ } ,
79
+ "compress" : {
80
+ type : "boolean" ,
81
+ describe : "Enable gzip compression" ,
82
+ group : RESPONSE_GROUP
83
+ } ,
84
+ "port" : {
85
+ describe : "The port" ,
86
+ group : CONNECTION_GROUP
87
+ } ,
88
+ "public" : {
89
+ type : "string" ,
90
+ describe : "The public hostname/ip address of the server" ,
91
+ group : CONNECTION_GROUP
92
+ } ,
93
+ "host" : {
94
+ type : "string" ,
95
+ default : "localhost" ,
96
+ describe : "The hostname/ip address the server will bind to" ,
97
+ group : CONNECTION_GROUP
98
+ }
99
+ } ) ;
59
100
60
- var argv = optimist . argv ;
101
+ var argv = yargs . argv ;
61
102
62
- var wpOpt = require ( "webpack/bin/convert-argv" ) ( optimist , argv , {
103
+ var wpOpt = require ( "webpack/bin/convert-argv" ) ( yargs , argv , {
63
104
outputFilename : "/bundle.js"
64
105
} ) ;
65
106
var firstWpOpt = Array . isArray ( wpOpt ) ? wpOpt [ 0 ] : wpOpt ;
0 commit comments