Skip to content

Commit 45b698d

Browse files
authored
feat: migrate flags to new configs format (#3089)
1 parent a9f4b45 commit 45b698d

File tree

1 file changed

+101
-2
lines changed

1 file changed

+101
-2
lines changed

bin/cli-flags.js

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,92 @@ module.exports = {
55
{
66
name: 'host',
77
type: String,
8+
configs: [
9+
{
10+
type: 'string',
11+
},
12+
],
813
description: 'The hostname/ip address the server will bind to.',
914
},
1015
{
1116
name: 'port',
1217
type: Number,
18+
configs: [
19+
{
20+
type: 'number',
21+
},
22+
],
1323
description: 'The port server will listen to.',
1424
},
1525
{
1626
name: 'static',
1727
type: [String, Boolean],
28+
configs: [
29+
{
30+
type: 'string',
31+
},
32+
{
33+
type: 'boolean',
34+
},
35+
],
1836
description: 'A directory to serve static content from.',
1937
multiple: true,
2038
negative: true,
2139
},
2240
{
2341
name: 'live-reload',
2442
type: Boolean,
43+
configs: [
44+
{
45+
type: 'boolean',
46+
},
47+
],
2548
description: 'Enables live reloading on changing files.',
2649
negatedDescription: 'Disables live reloading on changing files.',
2750
negative: true,
2851
},
2952
{
3053
name: 'https',
3154
type: Boolean,
55+
configs: [
56+
{
57+
type: 'boolean',
58+
},
59+
],
3260
description: 'Use HTTPS protocol.',
3361
negatedDescription: 'Do not use HTTPS protocol.',
3462
negative: true,
3563
},
3664
{
3765
name: 'http2',
3866
type: Boolean,
67+
configs: [
68+
{
69+
type: 'boolean',
70+
},
71+
],
3972
description: 'Use HTTP/2, must be used with HTTPS.',
4073
negatedDescription: 'Do not use HTTP/2.',
4174
negative: true,
4275
},
4376
{
4477
name: 'bonjour',
4578
type: Boolean,
79+
configs: [
80+
{
81+
type: 'boolean',
82+
},
83+
],
4684
description: 'Broadcasts the server via ZeroConf networking on start.',
4785
},
4886
{
4987
name: 'client-progress',
5088
type: Boolean,
89+
configs: [
90+
{
91+
type: 'boolean',
92+
},
93+
],
5194
description: 'Print compilation progress in percentage in the browser.',
5295
processor(opts) {
5396
opts.client = opts.client || {};
@@ -58,6 +101,11 @@ module.exports = {
58101
{
59102
name: 'setup-exit-signals',
60103
type: Boolean,
104+
configs: [
105+
{
106+
type: 'boolean',
107+
},
108+
],
61109
description: 'Close and exit the process on SIGINT and SIGTERM.',
62110
negatedDescription:
63111
'Do not close and exit the process on SIGNIT and SIGTERM.',
@@ -66,28 +114,56 @@ module.exports = {
66114
{
67115
name: 'stdin',
68116
type: Boolean,
117+
configs: [
118+
{
119+
type: 'boolean',
120+
},
121+
],
69122
description: 'Close when stdin ends.',
70123
},
71124
{
72125
name: 'open',
73-
type: [String, Boolean],
126+
type: [Boolean, String],
127+
configs: [
128+
{
129+
type: 'boolean',
130+
},
131+
{
132+
type: 'string',
133+
},
134+
],
74135
description:
75136
'Open the default browser, or optionally specify a browser name.',
76137
},
77138
{
78139
name: 'use-local-ip',
79140
type: Boolean,
141+
configs: [
142+
{
143+
type: 'boolean',
144+
},
145+
],
80146
description: 'Open default browser with local IP.',
81147
},
82148
{
83149
name: 'open-page',
84150
type: String,
151+
configs: [
152+
{
153+
type: 'string',
154+
},
155+
],
85156
description: 'Open default browser with the specified page.',
86157
multiple: true,
87158
},
88159
{
89160
name: 'client-logging',
90161
type: String,
162+
configs: [
163+
{
164+
type: 'string',
165+
},
166+
],
91167
description:
92168
'Log level in the browser (none, error, warn, info, log, verbose).',
93169
processor(opts) {
@@ -99,6 +175,11 @@ module.exports = {
99175
{
100176
name: 'history-api-fallback',
101177
type: Boolean,
178+
configs: [
179+
{
180+
type: 'boolean',
181+
},
182+
],
102183
description: 'Fallback to /index.html for Single Page Applications.',
103184
negatedDescription:
104185
'Do not fallback to /index.html for Single Page Applications.',
@@ -107,18 +188,36 @@ module.exports = {
107188
{
108189
name: 'compress',
109190
type: Boolean,
191+
configs: [
192+
{
193+
type: 'boolean',
194+
},
195+
],
110196
description: 'Enable gzip compression.',
111197
negatedDescription: 'Disable gzip compression.',
112198
negative: true,
113199
},
114200
{
115201
name: 'public',
116202
type: String,
203+
configs: [
204+
{
205+
type: 'string',
206+
},
207+
],
117208
description: 'The public hostname/ip address of the server.',
118209
},
119210
{
120211
name: 'firewall',
121-
type: [String, Boolean],
212+
type: [Boolean, String],
213+
configs: [
214+
{
215+
type: 'boolean',
216+
},
217+
{
218+
type: 'string',
219+
},
220+
],
122221
description:
123222
'Enable firewall or set hosts that are allowed to access the dev server.',
124223
negatedDescription: 'Disable firewall.',

0 commit comments

Comments
 (0)