cli-flags.js 4.58 KB
Newer Older
Kriengkrai Yothee's avatar
Kriengkrai Yothee committed
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
'use strict';

const ADVANCED_GROUP = 'Advanced options:';
const DISPLAY_GROUP = 'Stats options:';
const SSL_GROUP = 'SSL options:';
const CONNECTION_GROUP = 'Connection options:';
const RESPONSE_GROUP = 'Response options:';
const BASIC_GROUP = 'Basic options:';

module.exports = {
  devServer: [
    {
      name: 'bonjour',
      type: Boolean,
      describe: 'Broadcasts the server via ZeroConf networking on start',
    },
    {
      name: 'lazy',
      type: Boolean,
      describe: 'Lazy',
    },
    {
      name: 'liveReload',
      type: Boolean,
      defaultValue: true,
      describe: 'Enables/Disables live reloading on changing files',
    },
    {
      name: 'serveIndex',
      type: Boolean,
      describe: 'Enables/Disables serveIndex middleware',
      defaultValue: true,
    },
    {
      name: 'inline',
      type: Boolean,
      defaultValue: true,
      describe:
        'Inline mode (set to false to disable including client scripts like livereload)',
    },
    {
      name: 'profile',
      type: Boolean,
      describe: 'Print compilation profile data for progress steps',
    },
    {
      name: 'progress',
      type: Boolean,
      describe: 'Print compilation progress in percentage',
      group: BASIC_GROUP,
    },
    {
      name: 'hot-only',
      type: Boolean,
      describe: 'Do not refresh page if HMR fails',
      group: ADVANCED_GROUP,
    },
    {
      name: 'stdin',
      type: Boolean,
      describe: 'close when stdin ends',
    },
    {
      name: 'open',
      type: String,
      describe:
        'Open the default browser, or optionally specify a browser name',
    },
    {
      name: 'useLocalIp',
      type: Boolean,
      describe: 'Open default browser with local IP',
    },
    {
      name: 'open-page',
      type: String,
      describe: 'Open default browser with the specified page',
    },
    {
      name: 'client-log-level',
      type: String,
      group: DISPLAY_GROUP,
      defaultValue: 'info',
      describe:
        'Log level in the browser (trace, debug, info, warn, error or silent)',
    },
    {
      name: 'https',
      type: Boolean,
      group: SSL_GROUP,
      describe: 'HTTPS',
    },
    {
      name: 'http2',
      type: Boolean,
      group: SSL_GROUP,
      describe: 'HTTP/2, must be used with HTTPS',
    },
    {
      name: 'key',
      type: String,
      describe: 'Path to a SSL key.',
      group: SSL_GROUP,
    },
    {
      name: 'cert',
      type: String,
      describe: 'Path to a SSL certificate.',
      group: SSL_GROUP,
    },
    {
      name: 'cacert',
      type: String,
      describe: 'Path to a SSL CA certificate.',
      group: SSL_GROUP,
    },
    {
      name: 'pfx',
      type: String,
      describe: 'Path to a SSL pfx file.',
      group: SSL_GROUP,
    },
    {
      name: 'pfx-passphrase',
      type: String,
      describe: 'Passphrase for pfx file.',
      group: SSL_GROUP,
    },
    {
      name: 'content-base',
      type: String,
      describe: 'A directory or URL to serve HTML content from.',
      group: RESPONSE_GROUP,
    },
    {
      name: 'watch-content-base',
      type: Boolean,
      describe: 'Enable live-reloading of the content-base.',
      group: RESPONSE_GROUP,
    },
    {
      name: 'history-api-fallback',
      type: Boolean,
      describe: 'Fallback to /index.html for Single Page Applications.',
      group: RESPONSE_GROUP,
    },
    {
      name: 'compress',
      type: Boolean,
      describe: 'Enable gzip compression',
      group: RESPONSE_GROUP,
    },
    // findPort is currently not set up
    {
      name: 'port',
      type: Number,
      describe: 'The port',
      group: CONNECTION_GROUP,
    },
    {
      name: 'disable-host-check',
      type: Boolean,
      describe: 'Will not check the host',
      group: CONNECTION_GROUP,
    },
    {
      name: 'socket',
      type: String,
      describe: 'Socket to listen',
      group: CONNECTION_GROUP,
    },
    {
      name: 'public',
      type: String,
      describe: 'The public hostname/ip address of the server',
      group: CONNECTION_GROUP,
    },
    {
      name: 'host',
      type: String,
      describe: 'The hostname/ip address the server will bind to',
      group: CONNECTION_GROUP,
    },
    // use command-line-args "multiple" option, allowing the usage: --allowed-hosts host1 host2 host3
    // instead of the old, comma-separated syntax: --allowed-hosts host1,host2,host3
    {
      name: 'allowed-hosts',
      type: String,
      describe:
        'A list of hosts that are allowed to access the dev server, separated by spaces',
      group: CONNECTION_GROUP,
      multiple: true,
    },
  ],
};