options.js 4.4 KB

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