config-yargs.js
7.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
var CONFIG_GROUP = "Config options:";
var BASIC_GROUP = "Basic options:";
var MODULE_GROUP = "Module options:";
var OUTPUT_GROUP = "Output options:";
var ADVANCED_GROUP = "Advanced options:";
var RESOLVE_GROUP = "Resolving options:";
var OPTIMIZE_GROUP = "Optimizing options:";
module.exports = function(yargs) {
yargs
.help("help")
.alias("help", "h")
.version()
.alias("version", "v")
.options({
"config": {
type: "string",
describe: "Path to the config file",
group: CONFIG_GROUP,
defaultDescription: "webpack.config.js or webpackfile.js",
requiresArg: true
},
"config-name": {
type: "string",
describe: "Name of the config to use",
group: CONFIG_GROUP,
requiresArg: true
},
"env": {
describe: "Environment passed to the config, when it is a function",
group: CONFIG_GROUP
},
"context": {
type: "string",
describe: "The root directory for resolving entry point and stats",
group: BASIC_GROUP,
defaultDescription: "The current directory",
requiresArg: true
},
"entry": {
type: "string",
describe: "The entry point",
group: BASIC_GROUP,
requiresArg: true
},
"module-bind": {
type: "string",
describe: "Bind an extension to a loader",
group: MODULE_GROUP,
requiresArg: true
},
"module-bind-post": {
type: "string",
describe: "",
group: MODULE_GROUP,
requiresArg: true
},
"module-bind-pre": {
type: "string",
describe: "",
group: MODULE_GROUP,
requiresArg: true
},
"output-path": {
type: "string",
describe: "The output path for compilation assets",
group: OUTPUT_GROUP,
defaultDescription: "The current directory",
requiresArg: true
},
"output-filename": {
type: "string",
describe: "The output filename of the bundle",
group: OUTPUT_GROUP,
defaultDescription: "[name].js",
requiresArg: true
},
"output-chunk-filename": {
type: "string",
describe: "The output filename for additional chunks",
group: OUTPUT_GROUP,
defaultDescription: "filename with [id] instead of [name] or [id] prefixed",
requiresArg: true
},
"output-source-map-filename": {
type: "string",
describe: "The output filename for the SourceMap",
group: OUTPUT_GROUP,
requiresArg: true
},
"output-public-path": {
type: "string",
describe: "The public path for the assets",
group: OUTPUT_GROUP,
requiresArg: true
},
"output-jsonp-function": {
type: "string",
describe: "The name of the jsonp function used for chunk loading",
group: OUTPUT_GROUP,
requiresArg: true
},
"output-pathinfo": {
type: "boolean",
describe: "Include a comment with the request for every dependency (require, import, etc.)",
group: OUTPUT_GROUP
},
"output-library": {
type: "string",
describe: "Expose the exports of the entry point as library",
group: OUTPUT_GROUP,
requiresArg: true
},
"output-library-target": {
type: "string",
describe: "The type for exposing the exports of the entry point as library",
group: OUTPUT_GROUP,
requiresArg: true
},
"records-input-path": {
type: "string",
describe: "Path to the records file (reading)",
group: ADVANCED_GROUP,
requiresArg: true
},
"records-output-path": {
type: "string",
describe: "Path to the records file (writing)",
group: ADVANCED_GROUP,
requiresArg: true
},
"records-path": {
type: "string",
describe: "Path to the records file",
group: ADVANCED_GROUP,
requiresArg: true
},
"define": {
type: "string",
describe: "Define any free var in the bundle",
group: ADVANCED_GROUP,
requiresArg: true
},
"target": {
type: "string",
describe: "The targeted execution environment",
group: ADVANCED_GROUP,
requiresArg: true
},
"cache": {
type: "boolean",
describe: "Enable in memory caching",
default: null,
group: ADVANCED_GROUP,
defaultDescription: "It's enabled by default when watching"
},
"watch": {
type: "boolean",
alias: "w",
describe: "Watch the filesystem for changes",
group: BASIC_GROUP
},
"watch-stdin": {
type: "boolean",
alias: "stdin",
describe: "Exit the process when stdin is closed",
group: ADVANCED_GROUP
},
"watch-aggregate-timeout": {
describe: "Timeout for gathering changes while watching",
group: ADVANCED_GROUP,
requiresArg: true
},
"watch-poll": {
type: "string",
describe: "The polling interval for watching (also enable polling)",
group: ADVANCED_GROUP
},
"hot": {
type: "boolean",
describe: "Enables Hot Module Replacement",
group: ADVANCED_GROUP
},
"debug": {
type: "boolean",
describe: "Switch loaders to debug mode",
group: BASIC_GROUP
},
"devtool": {
type: "string",
describe: "Enable devtool for better debugging experience (Example: --devtool eval-cheap-module-source-map)",
group: BASIC_GROUP,
requiresArg: true
},
"resolve-alias": {
type: "string",
describe: "Setup a module alias for resolving (Example: jquery-plugin=jquery.plugin)",
group: RESOLVE_GROUP,
requiresArg: true
},
"resolve-extensions": {
"type": "array",
describe: "Setup extensions that should be used to resolve modules (Example: --resolve-extensions .es6,.js)",
group: RESOLVE_GROUP,
requiresArg: true
},
"resolve-loader-alias": {
type: "string",
describe: "Setup a loader alias for resolving",
group: RESOLVE_GROUP,
requiresArg: true
},
"optimize-max-chunks": {
describe: "Try to keep the chunk count below a limit",
group: OPTIMIZE_GROUP,
requiresArg: true
},
"optimize-min-chunk-size": {
describe: "Try to keep the chunk size above a limit",
group: OPTIMIZE_GROUP,
requiresArg: true
},
"optimize-minimize": {
type: "boolean",
describe: "Minimize javascript and switches loaders to minimizing",
group: OPTIMIZE_GROUP
},
"prefetch": {
type: "string",
describe: "Prefetch this request (Example: --prefetch ./file.js)",
group: ADVANCED_GROUP,
requiresArg: true
},
"provide": {
type: "string",
describe: "Provide these modules as free vars in all modules (Example: --provide jQuery=jquery)",
group: ADVANCED_GROUP,
requiresArg: true
},
"labeled-modules": {
type: "boolean",
describe: "Enables labeled modules",
group: ADVANCED_GROUP
},
"plugin": {
type: "string",
describe: "Load this plugin",
group: ADVANCED_GROUP,
requiresArg: true
},
"bail": {
type: "boolean",
describe: "Abort the compilation on first error",
group: ADVANCED_GROUP,
default: null
},
"profile": {
type: "boolean",
describe: "Profile the compilation and include information in stats",
group: ADVANCED_GROUP,
default: null
},
"d": {
type: "boolean",
describe: "shortcut for --debug --devtool eval-cheap-module-source-map --output-pathinfo",
group: BASIC_GROUP
},
"p": {
type: "boolean",
describe: "shortcut for --optimize-minimize --define process.env.NODE_ENV=\"production\"",
group: BASIC_GROUP
}
}).strict();
};