srv-it 0.1.1 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "srv-it",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Static server with polished CLI UI, directory listing, and live reload",
5
5
  "keywords": [
6
6
  "server",
@@ -43,7 +43,6 @@
43
43
  "open": "^10.1.2",
44
44
  "ws": "^8.18.0"
45
45
  },
46
- "devDependencies": {},
47
46
  "engines": {
48
47
  "node": ">=18"
49
48
  },
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
- 'srv - static server + directory listing + live reload',
27
+ title,
28
+ chalk.dim('Static server + directory listing + live reload'),
21
29
  '',
22
- 'USAGE',
23
- ' srv Serve current directory on port 3000',
24
- ' srv 4000 Serve current directory on port 4000',
25
- ' srv 4000 ./public Serve ./public on port 4000',
26
- ' srv ./public Serve ./public on port 3000',
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
- ' -h, --help Show help',
30
- ' -v, --version Show version',
31
- ' -p, --port <number> Port to listen on',
32
- ' --host <host> Host to bind to (default 0.0.0.0)',
33
- ' --open [path] Open browser (default /)',
34
- ' --no-open Do not open browser',
35
- ' --watch <path> Extra watch path (can be repeated)',
36
- ' --ignore <glob> Ignore glob/path for watcher (repeatable)',
37
- ' --no-css-inject Reload page on css changes instead of hot css refresh',
38
- ' --cors Enable CORS',
39
- ' --single SPA fallback to /index.html',
40
- ' --no-dir-listing Disable directory listing',
41
- ' --style <name> Listing style preset: midnight | paper | neon',
42
- ' --style-css <file> Custom CSS file for listing page',
43
- ' -c Create srv.config.json in served root if missing',
44
- ' --config <file> Read additional config JSON file',
45
- ' --no-request-logging Disable request logs',
46
- ' --log-level <0-3> Startup log verbosity',
47
- ' --ssl-cert <file> SSL certificate path',
48
- ' --ssl-key <file> SSL private key path',
49
- ' --ssl-pass <file> SSL passphrase file path',
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
 
package/src/server.js CHANGED
@@ -239,7 +239,7 @@ function renderDirListing({ pathnameValue, entries, style, customCss }) {
239
239
  </head>
240
240
  <body>
241
241
  <main>
242
- <h1>srv</h1>
242
+ <h1>srv-it</h1>
243
243
  <div class="path">Index of ${base}</div>
244
244
  ${up}
245
245
  <ul>${list}</ul>