prax-polyserve v1.0.0
polyserve
A simple development server for web projects.
polyserve serves project files from a URL root that allows relative URLs
that reach out of the project, like those starting with ../, to work. This is
necessary for referencing other packages by path when stored as a flat directory
such as how Bower works.
The local package is served at the URL /components/{bower-name}/, with files
served from the current directory. Other packages are served at
/components/{packageName} with files served from their directory under
./bower_components/.
Installation
$ npm install polyserve -gUsage
Run polyserve
$ cd my-element/
$ polyserveBrowse files
Navigate to localhost:8080/components/my-element/demo.html
Options
--version: Print version info.--rootstring: The root directory of your project. Defaults to the current working directory.--compilestring: Compiler options. Valid values are "auto", "always" and "never". "auto" compiles JavaScript to ES5 for browsers that don't fully support ES6.--module-resolutionstring: Algorithm to use for resolving module specifiers in import and export statements when rewriting them to be web-compatible. Valid values are "none" and "node". "none" disables module specifier rewriting. "node" uses Node.js resolution to find modules.--compile-cachenumber: Maximum size in bytes (actually, UTF-8 characters) of the cache used to store results for JavaScript compilation. Cache size includes the uncompiled and compiled file content lengths. Defaults to 52428800 (50MB).-p,--portnumber: The port to serve from. Serve will choose an open port for you by default.-H,--hostnamestring: The hostname to serve from. Defaults to localhost.-c,--component-dirstring: The component directory to use. Defaults to reading from the Bower config (usually bower_components/).-u,--component-urlstring: The component url to use. Defaults to reading from the Bower config (usually bower_components/).-n,--package-namestring: The package name to use for the root directory. Defaults to reading from bower.json.--npm: Sets npm mode: component directory is "node_modules" and the package name is read from package.json-o,--open: The page to open in the default browser on startup.-b,--browserstring[]: The browser(s) to open with when using the --open option. Defaults to your default web browser.--open-pathstring: The URL path to open when using the --open option. Defaults to "index.html".-P,--protocolstring: The server protocol to use {h2, https/1.1, http/1.1}. Defaults to "http/1.1".--keystring: Path to TLS certificate private key file for https. Defaults to "key.pem".--certstring: Path to TLS certificate file for https. Defaults to "cert.pem".--manifeststring: Path to HTTP/2 Push Manifest.--proxy-pathstring: Top-level path that should be redirected to the proxy-target. E.g.api/v1when you want to redirect all requests ofhttps://localhost/api/v1/.--proxy-targetstring: Host URL to proxy to, for examplehttps://myredirect:8080/foo.--help: Shows this help message
Compiling from Source
$ npm install
$ npm run buildYou can compile and run polyserve from source by cloning the repo from Github and then running npm run build. Make sure you have already run npm install before building.
Run Tests
$ npm test3 years ago