Skip to content

Commit 216beb3

Browse files
committed
1.0.0-beta.1
- Upgrade dependencies - Format code with prettier - Replace `var` with `const`/`let`
1 parent 5e7c50d commit 216beb3

File tree

5 files changed

+684
-74
lines changed

5 files changed

+684
-74
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
An HTTP server with livereload included. If a file inside the folder being served is changed, added or deleted, the browser will automatically reload.
44

5-
65
## Installing
76

87
npm install -g lr-http-server
@@ -11,15 +10,15 @@ An HTTP server with livereload included. If a file inside the folder being serve
1110

1211
lr-http-server [-p <port>] [-d <dir>] [-l livereloadport] [-w < watchPaths || false >] [-b]
1312

14-
**port** (default *8080*): Port to listen on
13+
**port** (default _8080_): Port to listen on
1514

16-
**dir** (default *.*): Folder to serve
15+
**dir** (default _._): Folder to serve
1716

18-
**url** (default *empty*): Path to open the specific page. *e.g.* `/#/main`
17+
**url** (default _empty_): Path to open the specific page. _e.g._ `/#/main`
1918

20-
**livereloadport** (default *35729*): Port for the livereload server. If `false` the livereload is disabled.
19+
**livereloadport** (default _35729_): Port for the livereload server. If `false` the livereload is disabled.
2120

22-
**watchPaths**: Comma-separated list of glob patterns for the files to watch. *e.g.* `**/*.js,**/*.css,**/*.html,**/*.xml`
21+
**watchPaths**: Comma-separated list of glob patterns for the files to watch. _e.g._ `**/*.js,**/*.css,**/*.html,**/*.xml`
2322

2423
**b**: disable browser open
2524

@@ -40,7 +39,7 @@ Default usage
4039

4140
All options
4241

43-
> lr-http-server -p 80 -d src/ -u /#/main -l 30000 -w **/*.css,*.html
42+
> lr-http-server -p 80 -d src/ -u /#/main -l 30000 -w **/*.css,*.html
4443

4544
HTTP server listening on port 80
4645
Serving <path>/src
@@ -49,4 +48,3 @@ All options
4948
Watching files:
5049
<path>/src/**/*.css
5150
<path>/src/*.html
52-

bin/lr-http-server

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,48 @@
11
#!/usr/bin/env node
22

3-
var simpleHttpMime = require('../src/index.js');
4-
var program = require('commander');
3+
const simpleHttpMime = require("../src/index.js");
4+
const program = require("commander");
55

66
function list(val) {
7-
return val.split(',');
7+
return val.split(",");
88
}
99

1010
program
11-
.option('-p, --port <portNumber>', 'Port number', parseInt)
12-
.option('-d, --dir <path>', 'Directory to serve')
13-
.option('-u, --url <path>', 'Url to opening file')
14-
.option('-l, --livereload <portNumber>', 'Port for the livereload server. Disabled if `false`')
15-
.option('-w, --watchFiles <paths>', 'Comma-separated list of glob patterns of files to watch', list)
16-
.option('-b, --disableBrowserOpen', 'Disable opening a browser window on the server root')
17-
.option('-e, --extensions <exts>', 'Comma-separated list of extensions which will be added to file name if the file not found (think like /foo -> /foo.html)', list)
18-
.option('-D, --debounce-delay <n>', 'The applied delay for file watching in milliseconds, it can be used for grouping changes', parseFloat)
11+
.option("-p, --port <portNumber>", "Port number", parseInt)
12+
.option("-d, --dir <path>", "Directory to serve")
13+
.option("-u, --url <path>", "Url to opening file")
14+
.option(
15+
"-l, --livereload <portNumber>",
16+
"Port for the livereload server. Disabled if `false`"
17+
)
18+
.option(
19+
"-w, --watchFiles <paths>",
20+
"Comma-separated list of glob patterns of files to watch",
21+
list
22+
)
23+
.option(
24+
"-b, --disableBrowserOpen",
25+
"Disable opening a browser window on the server root"
26+
)
27+
.option(
28+
"-e, --extensions <exts>",
29+
"Comma-separated list of extensions which will be added to file name if the file not found (think like /foo -> /foo.html)",
30+
list
31+
)
32+
.option(
33+
"-D, --debounce-delay <n>",
34+
"The applied delay for file watching in milliseconds, it can be used for grouping changes",
35+
parseFloat
36+
)
1937
.parse(process.argv);
2038

21-
simpleHttpMime(program.port, program.dir, program.url, program.livereload, program.watchFiles, !program.disableBrowserOpen, program.extensions, program.debounceDelay);
39+
simpleHttpMime(
40+
program.port,
41+
program.dir,
42+
program.url,
43+
program.livereload,
44+
program.watchFiles,
45+
!program.disableBrowserOpen,
46+
program.extensions,
47+
program.debounceDelay
48+
);

0 commit comments

Comments
 (0)