Compatibility of option flags and missing features
Hi there,
I have been long user of serve and what I liked about the server is that it was a simpler alternative to http-server. However, I noticed the latest version of serve is now using different options compared to the last stable version 1.4.0. It seems that now some options are assumed as defaults (like compression enabled by default).
Somehow I prefer to specify explicitly if I want to enable a feature in the server or not, it's a much simpler mental model for using CLIs. I understand there is an ongoing code refactor but not sure why the server options are not backwards compatible?
For example, the latest serve version has the following options:
$ serve --help
Usage: serve [options] [command]
Commands:
help Display help
Options:
-a, --auth Serve behind basic auth
-c, --cache <n> How long static files should be cached in the browser (seconds) (defaults to 3600)
-o, --cors Setup * CORS headers to allow requests from any origin (disabled by default)
-h, --help Output usage information
-i, --ignore Files and directories to ignore (defaults to "")
-p, --port <n> Port to listen on (defaults to 3000)
-s, --single Serve single page apps with only one index.html
-u, --unzipped Disable GZIP compression
-v, --version Output the version number
but version 1.4.0 uses this:
$ serve --help
Usage: serve [options] [dir]
Options:
-h, --help output usage information
-V, --version output the version number
-a, --auth <user>:<pass> specify basic auth credentials
-F, --format <fmt> specify the log format string
-p, --port <port> specify the port [3000]
-H, --hidden enable hidden file serving
-S, --no-stylus disable stylus rendering
-J, --no-jade disable jade rendering
--no-less disable less css rendering
-I, --no-icons disable icons
-L, --no-logs disable request logging
-D, --no-dirs disable directory serving
-f, --favicon <path> serve the given favicon
-C, --cors allows cross origin access serving
--compress gzip or deflate the response
--exec <cmd> execute command on each request
From looking at the server options, it seems some features are missing from the latest version?
One last thing, there seems to be an inconsistency (or bug) when passing a folder to serve (in latest version):
In serve 2.1.2:
# this doesn't pick up the folder as input
serve --cors ./my-folder
Running on http://localhost:3000
Hint: check your README.md
Run it
$ serve <path> [options]
In serve 1.4.0:
# this picks up the folder as input
serve --cors ./my-folder
serving /Users/random/my-folder on port 3000
This is the old package. The package name is now owned by a different group of people (@zeit - us) and we added a different content to it.
According to the semver spec, we acted just right and incremented the major version number.