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