UNPKG

1.32 kBJavaScriptView Raw
1var _assign = require("lodash/assign");
2var clone = require("lodash/cloneDeep");
3var makeStealConfig = require("./make_steal_config");
4var options = clone(require("./options"));
5var winston = require("winston");
6
7module.exports = {
8 command: "live-reload",
9
10 builder: _assign({}, options, {
11 "live-reload-port": {
12 type: "string",
13 default: 8012,
14 describe: "Specify a port to use for the websocket server"
15 },
16 "ssl-key": {
17 type: "string",
18 default: null,
19 describe: "Path to the private key of the server in PEM format"
20 },
21 "ssl-cert": {
22 type: "string",
23 default: null,
24 describe: "Path to the certificate key of the server in PEM format"
25 },
26 "ssl-pfx": {
27 type: "string",
28 default: null,
29 describe: "Path to the private key, certificate and CA certs of the server in PFX or PKCS12 format"
30 }
31 }),
32
33 describe: "Start a live-reload Web Socket server",
34
35 handler: function(argv) {
36 var liveReload = require("../stream/live");
37
38 var options = argv;
39 var config = makeStealConfig(argv);
40
41 if ((options.sslCert && !options.sslKey) || (options.sslKey && !options.sslCert)) {
42 winston.error("ssl-key and ssl-cert are dependant and must be specified together".red);
43 process.exit(1);
44 }
45
46 options.liveReload = true;
47 options.quiet = true;
48 liveReload(config, options);
49 }
50};