From dca50f1fccae9045607fadd247ec51abb4a9df9e Mon Sep 17 00:00:00 2001 From: Gabriel Reitz Giannattasio Date: Fri, 1 Sep 2017 10:54:59 +0900 Subject: [PATCH 1/3] Add support to change the host in the plugin options --- plugin/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/index.js b/plugin/index.js index 45fc0b8..35ae6c8 100644 --- a/plugin/index.js +++ b/plugin/index.js @@ -12,6 +12,7 @@ const InspectpackDaemon = require('inspectpack').daemon; const serializeError = require('../utils/error-serialization').serializeError; const DEFAULT_PORT = 9838; +const DEFAULT_HOST = '127.0.0.1'; const ONE_SECOND = 1000; const INSPECTPACK_PROBLEM_ACTIONS = ['versions', 'duplicates']; const INSPECTPACK_PROBLEM_TYPE = 'problems'; @@ -122,6 +123,7 @@ class DashboardPlugin { } else { options = options || {}; this.port = options.port || DEFAULT_PORT; + this.host = options.host || DEFAULT_HOST; this.handler = options.handler || null; } @@ -152,7 +154,7 @@ class DashboardPlugin { if (!handler) { handler = noop; const port = this.port; - const host = '127.0.0.1'; + const host = this.host; this.socket = new SocketIOClient(`http://${host}:${port}`); this.socket.on('connect', () => { handler = this.socket.emit.bind(this.socket, 'message'); From e5b35cc15b226839769811633d6f1fcf6df7b75a Mon Sep 17 00:00:00 2001 From: Gabriel Reitz Giannattasio Date: Fri, 1 Sep 2017 10:55:40 +0900 Subject: [PATCH 2/3] Add the host option to the documentation and clarify in the docs what act as server and what act as client --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0cb45d8..09a2e66 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Then, sit back and pretend you're an astronaut. - `-c, --color [color]` - Custom ANSI color for your dashboard - `-m, --minimal` - Runs the dashboard in minimal mode - `-t, --title [title]` - Set title of terminal window - - `-p, --port [port]` - Custom port for socket communication + - `-p, --port [port]` - Custom port for socket communication server ##### Arguments @@ -82,7 +82,8 @@ Then, sit back and pretend you're an astronaut. #### Webpack plugin #### Options - - `port` - Custom port for socket communication + - `port` - Custom port for connecting the socket client + - `host` - Custom host for connection the socket client - `handler` - Plugin handler method, i.e. `dashboard.setData` *Note: you can also just pass a function in as an argument, which then becomes the handler, i.e. `new DashboardPlugin(dashboard.setData)`* From b222b02e099945230182d44ceaf6bb082391ed00 Mon Sep 17 00:00:00 2001 From: Gabriel Reitz Giannattasio Date: Wed, 13 Sep 2017 22:40:48 +0900 Subject: [PATCH 3/3] Fix the double quote lint error --- plugin/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/index.js b/plugin/index.js index 3081809..e7c3f0d 100644 --- a/plugin/index.js +++ b/plugin/index.js @@ -12,7 +12,7 @@ const InspectpackDaemon = require("inspectpack").daemon; const serializeError = require("../utils/error-serialization").serializeError; const DEFAULT_PORT = 9838; -const DEFAULT_HOST = '127.0.0.1'; +const DEFAULT_HOST = "127.0.0.1"; const ONE_SECOND = 1000; const INSPECTPACK_PROBLEM_ACTIONS = ["versions", "duplicates"]; const INSPECTPACK_PROBLEM_TYPE = "problems";