srv-it 0.1.1 → 0.2.0
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/package.json +1 -1
- package/src/cli.js +39 -29
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -16,43 +16,53 @@ function isNumeric(value) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function getHelpText() {
|
|
19
|
+
const repository =
|
|
20
|
+
typeof pkg.repository === 'object' && pkg.repository && pkg.repository.url
|
|
21
|
+
? pkg.repository.url.replace(/^git\+/, '').replace(/\.git$/, '')
|
|
22
|
+
: pkg.homepage || 'https://github.com/elouan/srv-it';
|
|
23
|
+
|
|
24
|
+
const title = `${chalk.bold.cyan('srv')} ${chalk.bold.white(`v${pkg.version}`)}`;
|
|
25
|
+
|
|
19
26
|
return [
|
|
20
|
-
|
|
27
|
+
title,
|
|
28
|
+
chalk.dim('Static server + directory listing + live reload'),
|
|
21
29
|
'',
|
|
22
|
-
'USAGE',
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
30
|
+
chalk.bold('USAGE'),
|
|
31
|
+
` ${chalk.cyan('srv')} Serve current directory on port 3000`,
|
|
32
|
+
` ${chalk.cyan('srv 4000')} Serve current directory on port 4000`,
|
|
33
|
+
` ${chalk.cyan('srv 4000 ./public')} Serve ./public on port 4000`,
|
|
34
|
+
` ${chalk.cyan('srv ./public')} Serve ./public on port 3000`,
|
|
27
35
|
'',
|
|
28
|
-
'OPTIONS',
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
36
|
+
chalk.bold('OPTIONS'),
|
|
37
|
+
` ${chalk.yellow('-h, --help')} Show help`,
|
|
38
|
+
` ${chalk.yellow('-v, --version')} Show version`,
|
|
39
|
+
` ${chalk.yellow('-p, --port <number>')} Port to listen on`,
|
|
40
|
+
` ${chalk.yellow('--host <host>')} Host to bind to (default 0.0.0.0)`,
|
|
41
|
+
` ${chalk.yellow('--open [path]')} Open browser (default /)`,
|
|
42
|
+
` ${chalk.yellow('--no-open')} Do not open browser`,
|
|
43
|
+
` ${chalk.yellow('--watch <path>')} Extra watch path (can be repeated)`,
|
|
44
|
+
` ${chalk.yellow('--ignore <glob>')} Ignore glob/path for watcher (repeatable)`,
|
|
45
|
+
` ${chalk.yellow('--no-css-inject')} Reload page on css changes instead of hot css refresh`,
|
|
46
|
+
` ${chalk.yellow('--cors')} Enable CORS`,
|
|
47
|
+
` ${chalk.yellow('--single')} SPA fallback to /index.html`,
|
|
48
|
+
` ${chalk.yellow('--no-dir-listing')} Disable directory listing`,
|
|
49
|
+
` ${chalk.yellow('--style <name>')} Listing style preset: midnight | paper | neon`,
|
|
50
|
+
` ${chalk.yellow('--style-css <file>')} Custom CSS file for listing page`,
|
|
51
|
+
` ${chalk.yellow('-c')} Create srv.config.json in served root if missing`,
|
|
52
|
+
` ${chalk.yellow('--config <file>')} Read additional config JSON file`,
|
|
53
|
+
` ${chalk.yellow('--no-request-logging')} Disable request logs`,
|
|
54
|
+
` ${chalk.yellow('--log-level <0-3>')} Startup log verbosity`,
|
|
55
|
+
` ${chalk.yellow('--ssl-cert <file>')} SSL certificate path`,
|
|
56
|
+
` ${chalk.yellow('--ssl-key <file>')} SSL private key path`,
|
|
57
|
+
` ${chalk.yellow('--ssl-pass <file>')} SSL passphrase file path`,
|
|
50
58
|
'',
|
|
51
|
-
'CONFIG FILES',
|
|
59
|
+
chalk.bold('CONFIG FILES'),
|
|
52
60
|
' ~/.srvrc.json (global defaults)',
|
|
53
61
|
' ./srv.config.json (project defaults)',
|
|
54
62
|
'',
|
|
55
63
|
'CLI options always override config values.',
|
|
64
|
+
'',
|
|
65
|
+
`${chalk.bold('More config docs:')} ${chalk.underline(repository)}`,
|
|
56
66
|
].join('\n');
|
|
57
67
|
}
|
|
58
68
|
|