sable 0.5.17 → 0.5.18

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
@@ -3,7 +3,17 @@
3
3
  [![test](https://github.com/kei-ito/sable/actions/workflows/test.yml/badge.svg)](https://github.com/kei-ito/sable/actions/workflows/test.yml)
4
4
  [![codecov](https://codecov.io/gh/kei-ito/sable/branch/master/graph/badge.svg)](https://codecov.io/gh/kei-ito/sable)
5
5
 
6
- Starts a server for development.
6
+ An HTTP development server that serves static files and reloads the browser when files change. If the configured port is already in use, sable automatically tries the next one, so multiple projects can run side by side without any configuration changes.
7
+
8
+ ## Quick start
9
+
10
+ No installation required. Run the following command to serve the current directory:
11
+
12
+ ```
13
+ npx sable .
14
+ ```
15
+
16
+ The server URL is printed to stdout once it is ready. Edit any file in the directory and the browser reloads automatically.
7
17
 
8
18
  ## Install
9
19
 
@@ -15,17 +25,19 @@ npm install sable --save-dev
15
25
 
16
26
  ```
17
27
  $ sable -h
18
- Usage: sable [options] <documentRoot ...>
28
+ Usage: sable [options] [documentRoot...]
19
29
 
20
- Starts a HTTP server for development
30
+ Starts an HTTP development server
21
31
 
22
32
  Options:
23
- -V, --version output the version number
24
- -p, --port <n> A port number for HTTP, HTTPS (4000)
25
- -h, --host <s> Hostname
26
- --noWatch Disable watching
27
- -i, --index <s> A filename of index (index.html)
28
- -h, --help output usage information
33
+ -V, --version Output the version number
34
+ -p, --port <n> Port number for HTTP/HTTPS (default: 4000)
35
+ -h, --host <s> Host name to bind
36
+ -v, --verbose Enable verbose logging
37
+ --noWatch Set the watch option to false
38
+ -i, --index <s> Value for the index option (default: index.html)
39
+ [documentRoot...] Directories that contain files to be served
40
+ -h, --help Output usage information
29
41
  ```
30
42
 
31
43
  ## Javascript API
@@ -38,11 +50,11 @@ startServer({/* options */})
38
50
 
39
51
  ### Options
40
52
 
41
- `startServer` supports all of the options provided by [middleware-static-livereload]
42
- , `port`, `host` and `middlewares`.
53
+ `startServer` supports all options from [middleware-static-livereload], plus
54
+ `port`, `host`, and `middlewares`.
43
55
 
44
56
  ```javascript
45
- interface SableOptions extends MiddlewareStaticLivereload.Options {
57
+ interface SableOptions extends Partial<MiddlewareOptions> {
46
58
  /**
47
59
  * The first argument of server.listen()
48
60
  * https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback
package/cjs/cli.cjs CHANGED
@@ -74,11 +74,11 @@ if (!packageJsonPath) {
74
74
  throw new Error("Unable to resolve path to package.json");
75
75
  }
76
76
  var { version } = JSON.parse((0, import_node_fs.readFileSync)(packageJsonPath, "utf8"));
77
- var program = new import_commander.Command().version(version).description("Starts a HTTP server for development").option(
77
+ var program = new import_commander.Command().version(version).description("Starts an HTTP development server").option(
78
78
  "-p, --port <n>",
79
- "A port number for HTTP, HTTPS (4000)",
79
+ "Port number for HTTP/HTTPS (default: 4000)",
80
80
  Number.parseInt
81
- ).option("-h, --host <s>", "Hostname").option("-v, --verbose", "Enable verbose logging").option("--noWatch", "Disable watching").option("-i, --index <s>", "A filename of index (index.html)").argument("[documentRoot...]", "Paths to serve");
81
+ ).option("-h, --host <s>", "Host name to bind").option("-v, --verbose", "Enable verbose logging").option("--noWatch", "Set the watch option to false").option("-i, --index <s>", "Value for the index option (default: index.html)").argument("[documentRoot...]", "Directories that contain files to be served");
82
82
  program.parse();
83
83
  var {
84
84
  noWatch,
package/esm/cli.mjs CHANGED
@@ -50,11 +50,11 @@ if (!packageJsonPath) {
50
50
  throw new Error("Unable to resolve path to package.json");
51
51
  }
52
52
  var { version } = JSON.parse(readFileSync(packageJsonPath, "utf8"));
53
- var program = new Command().version(version).description("Starts a HTTP server for development").option(
53
+ var program = new Command().version(version).description("Starts an HTTP development server").option(
54
54
  "-p, --port <n>",
55
- "A port number for HTTP, HTTPS (4000)",
55
+ "Port number for HTTP/HTTPS (default: 4000)",
56
56
  Number.parseInt
57
- ).option("-h, --host <s>", "Hostname").option("-v, --verbose", "Enable verbose logging").option("--noWatch", "Disable watching").option("-i, --index <s>", "A filename of index (index.html)").argument("[documentRoot...]", "Paths to serve");
57
+ ).option("-h, --host <s>", "Host name to bind").option("-v, --verbose", "Enable verbose logging").option("--noWatch", "Set the watch option to false").option("-i, --index <s>", "Value for the index option (default: index.html)").argument("[documentRoot...]", "Directories that contain files to be served");
58
58
  program.parse();
59
59
  var {
60
60
  noWatch,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sable",
3
- "version": "0.5.17",
4
- "description": "Starts a server and a file watcher",
3
+ "version": "0.5.18",
4
+ "description": "HTTP development server with file watching",
5
5
  "author": {
6
6
  "name": "Kei Ito",
7
7
  "email": "kei.itof@gmail.com",
@@ -30,18 +30,19 @@
30
30
  "types"
31
31
  ],
32
32
  "scripts": {
33
- "lint": "npx @biomejs/biome lint",
33
+ "lint": "npx @biomejs/biome check",
34
+ "format": "npx @biomejs/biome format --write",
34
35
  "build": "run-s build:*",
35
36
  "build:typedef": "tsc --project tsconfig.typedef.json",
36
37
  "build:code": "node build.ts",
37
38
  "test": "node --test test/index.mjs",
38
- "version": "run-s version:changelog version:add",
39
+ "version": "run-s version:changelog format version:add",
39
40
  "version:changelog": "npx @nlib/changelog --output CHANGELOG.md",
40
41
  "version:add": "git add ."
41
42
  },
42
43
  "dependencies": {
43
- "commander": "14.0.1",
44
+ "commander": "14.0.2",
44
45
  "connect": "3.7.0",
45
- "middleware-static-livereload": "1.4.3"
46
+ "middleware-static-livereload": "1.5.2"
46
47
  }
47
48
  }