options.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. 'use strict';
  2. /* eslint-disable
  3. global-require,
  4. multiline-ternary,
  5. space-before-function-paren
  6. */
  7. const ADVANCED_GROUP = 'Advanced options:';
  8. const DISPLAY_GROUP = 'Stats options:';
  9. const SSL_GROUP = 'SSL options:';
  10. const CONNECTION_GROUP = 'Connection options:';
  11. const RESPONSE_GROUP = 'Response options:';
  12. const BASIC_GROUP = 'Basic options:';
  13. const options = {
  14. bonjour: {
  15. type: 'boolean',
  16. describe: 'Broadcasts the server via ZeroConf networking on start',
  17. },
  18. lazy: {
  19. type: 'boolean',
  20. describe: 'Lazy',
  21. },
  22. liveReload: {
  23. type: 'boolean',
  24. describe: 'Enables/Disables live reloading on changing files',
  25. default: true,
  26. },
  27. serveIndex: {
  28. type: 'boolean',
  29. describe: 'Enables/Disables serveIndex middleware',
  30. default: true,
  31. },
  32. inline: {
  33. type: 'boolean',
  34. default: true,
  35. describe:
  36. 'Inline mode (set to false to disable including client scripts like livereload)',
  37. },
  38. progress: {
  39. type: 'boolean',
  40. describe: 'Print compilation progress in percentage',
  41. group: BASIC_GROUP,
  42. },
  43. 'hot-only': {
  44. type: 'boolean',
  45. describe: 'Do not refresh page if HMR fails',
  46. group: ADVANCED_GROUP,
  47. },
  48. stdin: {
  49. type: 'boolean',
  50. describe: 'close when stdin ends',
  51. },
  52. open: {
  53. type: 'string',
  54. describe: 'Open the default browser, or optionally specify a browser name',
  55. },
  56. useLocalIp: {
  57. type: 'boolean',
  58. describe: 'Open default browser with local IP',
  59. },
  60. 'open-page': {
  61. type: 'string',
  62. describe: 'Open default browser with the specified page',
  63. requiresArg: true,
  64. },
  65. color: {
  66. type: 'boolean',
  67. alias: 'colors',
  68. default: function supportsColor() {
  69. // Use `require('supports-color').stdout` for supports-color >= 5.0.0.
  70. // See https://github.com/webpack/webpack-dev-server/pull/1555.
  71. return require('supports-color').stdout;
  72. },
  73. group: DISPLAY_GROUP,
  74. describe: 'Enables/Disables colors on the console',
  75. },
  76. info: {
  77. type: 'boolean',
  78. group: DISPLAY_GROUP,
  79. default: true,
  80. describe: 'Info',
  81. },
  82. quiet: {
  83. type: 'boolean',
  84. group: DISPLAY_GROUP,
  85. describe: 'Quiet',
  86. },
  87. 'client-log-level': {
  88. type: 'string',
  89. group: DISPLAY_GROUP,
  90. default: 'info',
  91. describe:
  92. 'Log level in the browser (trace, debug, info, warn, error or silent)',
  93. },
  94. https: {
  95. type: 'boolean',
  96. group: SSL_GROUP,
  97. describe: 'HTTPS',
  98. },
  99. http2: {
  100. type: 'boolean',
  101. group: SSL_GROUP,
  102. describe: 'HTTP/2, must be used with HTTPS',
  103. },
  104. key: {
  105. type: 'string',
  106. describe: 'Path to a SSL key.',
  107. group: SSL_GROUP,
  108. },
  109. cert: {
  110. type: 'string',
  111. describe: 'Path to a SSL certificate.',
  112. group: SSL_GROUP,
  113. },
  114. cacert: {
  115. type: 'string',
  116. describe: 'Path to a SSL CA certificate.',
  117. group: SSL_GROUP,
  118. },
  119. pfx: {
  120. type: 'string',
  121. describe: 'Path to a SSL pfx file.',
  122. group: SSL_GROUP,
  123. },
  124. 'pfx-passphrase': {
  125. type: 'string',
  126. describe: 'Passphrase for pfx file.',
  127. group: SSL_GROUP,
  128. },
  129. 'content-base': {
  130. type: 'string',
  131. describe: 'A directory or URL to serve HTML content from.',
  132. group: RESPONSE_GROUP,
  133. },
  134. 'watch-content-base': {
  135. type: 'boolean',
  136. describe: 'Enable live-reloading of the content-base.',
  137. group: RESPONSE_GROUP,
  138. },
  139. 'history-api-fallback': {
  140. type: 'boolean',
  141. describe: 'Fallback to /index.html for Single Page Applications.',
  142. group: RESPONSE_GROUP,
  143. },
  144. compress: {
  145. type: 'boolean',
  146. describe: 'Enable gzip compression',
  147. group: RESPONSE_GROUP,
  148. },
  149. port: {
  150. describe: 'The port',
  151. group: CONNECTION_GROUP,
  152. },
  153. 'disable-host-check': {
  154. type: 'boolean',
  155. describe: 'Will not check the host',
  156. group: CONNECTION_GROUP,
  157. },
  158. socket: {
  159. type: 'String',
  160. describe: 'Socket to listen',
  161. group: CONNECTION_GROUP,
  162. },
  163. public: {
  164. type: 'string',
  165. describe: 'The public hostname/ip address of the server',
  166. group: CONNECTION_GROUP,
  167. },
  168. host: {
  169. type: 'string',
  170. default: 'localhost',
  171. describe: 'The hostname/ip address the server will bind to',
  172. group: CONNECTION_GROUP,
  173. },
  174. 'allowed-hosts': {
  175. type: 'string',
  176. describe:
  177. 'A comma-delimited string of hosts that are allowed to access the dev server',
  178. group: CONNECTION_GROUP,
  179. },
  180. };
  181. module.exports = options;