coc-live-server 0.0.9 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,17 +12,19 @@ Launch a development local Server with live reload feature for static & dynamic
12
12
  ## Configuration options
13
13
 
14
14
  - `coc-live-server.enabled`: Enable coc-live-server extension, default: `true`
15
- - `coc-live-server.host`: server host, default: `0.0.0.0`
16
- - `coc-live-server.port`: server port, default: `8080`
17
- - `coc-live-server.cors`: cors, default: `false`
18
- - `coc-live-server.wait`: wait, default: `100`
19
- - `coc-live-server.index`: index file, default: `index.html`
15
+ - `coc-live-server.host`: Host for the live server, default: `0.0.0.0`
16
+ - `coc-live-server.port`: Port number for the live server, default: `8080`
17
+ - `coc-live-server.cors`: Enable CORS for the live server, default: `false`
18
+ - `coc-live-server.wait`: Wait time in milliseconds before reloading the page after a file change is detected, default: `100`
19
+ - `coc-live-server.spa`: translate requests from /abc to /#/abc (handy for Single Page Apps), default: `false`
20
+ - `coc-live-server.index`: Default file to serve when accessing the root URL, default: `index.html`
21
+ - `coc-live-server.open`: Open the browser automatically when the server starts, default: `true`
20
22
 
21
23
  ## Commands
22
24
 
23
- - `coc-live-server.toggle`: Toggle Live Server
24
- - `coc-live-server.start`: Start Live Server
25
- - `coc-live-server.stop`: Stop Live Server
25
+ - `live-server.toggle`: Toggle Live Server
26
+ - `live-server.start`: Start Live Server
27
+ - `live-server.stop`: Stop Live Server
26
28
 
27
29
  ---
28
30
 
package/lib/index.js CHANGED
@@ -58,6 +58,7 @@ function startLiveServer() {
58
58
  const cors = getConfigItem("cors");
59
59
  const wait = getConfigItem("wait", 100);
60
60
  const spa = getConfigItem("spa");
61
+ const open = getConfigItem("open", true);
61
62
  const index = getConfigItem("index", "index.html");
62
63
  const STATUS = `liveServer[:${port}]`;
63
64
  const args = [];
@@ -79,6 +80,9 @@ function startLiveServer() {
79
80
  if (spa) {
80
81
  args.push(" --spa");
81
82
  }
83
+ if (!open) {
84
+ args.push(" --no-browser");
85
+ }
82
86
  if (wait && typeof wait === "number") {
83
87
  args.push(" --wait=" + wait);
84
88
  }
@@ -148,13 +152,13 @@ async function activate(context) {
148
152
  return;
149
153
  }
150
154
  context.subscriptions.push(
151
- import_coc3.commands.registerCommand("coc-live-server.start", () => {
155
+ import_coc3.commands.registerCommand("live-server.start", () => {
152
156
  startLiveServer();
153
157
  }),
154
- import_coc3.commands.registerCommand("coc-live-server.stop", () => {
158
+ import_coc3.commands.registerCommand("live-server.stop", () => {
155
159
  stopLiveServer();
156
160
  }),
157
- import_coc3.commands.registerCommand("coc-live-server.toggle", () => {
161
+ import_coc3.commands.registerCommand("live-server.toggle", () => {
158
162
  toggleLiveServer();
159
163
  })
160
164
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-live-server",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "description": "Launch a development local Server with live reload feature for static & dynamic pages.",
5
5
  "author": "cyl <a1008611abcd@126.com>",
6
6
  "license": "MIT",
@@ -65,20 +65,25 @@
65
65
  "type": "boolean",
66
66
  "default": false,
67
67
  "description": "translate requests from /abc to /#/abc (handy for Single Page Apps)"
68
+ },
69
+ "coc-live-server.open": {
70
+ "type": "boolean",
71
+ "default": true,
72
+ "description": "Open the browser automatically when the server starts"
68
73
  }
69
74
  }
70
75
  },
71
76
  "commands": [
72
77
  {
73
- "command": "coc-live-server.start",
78
+ "command": "live-server.start",
74
79
  "title": "Start Live Server"
75
80
  },
76
81
  {
77
- "command": "coc-live-server.stop",
82
+ "command": "live-server.stop",
78
83
  "title": "Stop Live Server"
79
84
  },
80
85
  {
81
- "command": "coc-live-server.toggle",
86
+ "command": "live-server.toggle",
82
87
  "title": "Toggle Live Server"
83
88
  }
84
89
  ]