Skip to content

Commit

Permalink
Replaces live-server with five-server
Browse files Browse the repository at this point in the history
This replaces `live-server` with `five-server`, which is a fork/rewrite
of `live-server` which is maintained.

One issue that I found was that `five-server` adds a toast message upon
every page reload which is ugly, so I took the liberty of hiding that
info message. Other than that, it appears to work correctly.

Before this commit, `aiur` passed the `liveserver` parameter into faucet
and faucet took care of activating the liveserver (prompting the user to
install `live-server` if they hadn't already). I've modified the `aiur`
script so that it no longer passes that parameter into faucet, but
instead activates our own server implementation using `five-server`
  • Loading branch information
joyheron authored and moonglum committed Jun 23, 2021
1 parent 632de70 commit b646258
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions bin/aiur
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

let faucet = require("faucet-pipeline-core");
let parseCLI = require("../lib/cli");
let server = require("../lib/server");

let { referenceDir, config, options } = parseCLI();
let liveserve = options.liveserve;

// We want to use our own live-server implementation instead of faucet
delete options.liveserve;
faucet(referenceDir, config, options);

server.live(liveserve, config.manifest.webRoot);
8 changes: 8 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let { _parseHost } = require("faucet-pipeline-core/lib/server");

exports.live = (config, root) => {
let LiveServer = require("five-server").default;
let [host, port] = _parseHost(config);

new LiveServer().start({ port, host, root, open: false });
};
5 changes: 5 additions & 0 deletions lib/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,8 @@ resize-handle {
display: block;
}
}

/* disable five-server toast messages on page reload */
#fiveserver-info-wrapper {
visibility: hidden;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"faucet-pipeline-jsx": "^2.1.7",
"faucet-pipeline-sass": "^1.6.0",
"faucet-pipeline-static": "^1.2.0",
"five-server": "^0.0.26",
"handlebars": "^4.7.7",
"live-server": "^1.2.1",
"metacolon": "^1.1.0",
"minimist": "^1.2.5",
"mkdirp": "^1.0.4",
Expand Down

0 comments on commit b646258

Please sign in to comment.