options.js 4.1 KB

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