|
7 | 7 | *
|
8 | 8 | */
|
9 | 9 |
|
10 |
| -const {WebSocketHost, table} = require("@jpmorganchase/perspective/build/perspective.node.js"); |
| 10 | +const {WebSocketHost, table} = require("@jpmorganchase/perspective"); |
11 | 11 | const {read_stdin, open_browser} = require("./utils.js");
|
12 | 12 | const fs = require("fs");
|
13 | 13 | const path = require("path");
|
@@ -66,8 +66,11 @@ async function convert(filename, options) {
|
66 | 66 | * @param {*} options
|
67 | 67 | */
|
68 | 68 | async function host(filename, options) {
|
69 |
| - const files = path.join(__dirname, "html"); |
70 |
| - const server = new WebSocketHost({assets: [files], port: options.port}); |
| 69 | + let files = [path.join(__dirname, "html")]; |
| 70 | + if (options.assets) { |
| 71 | + files = [options.assets, ...files]; |
| 72 | + } |
| 73 | + const server = new WebSocketHost({assets: files, port: options.port}); |
71 | 74 | let file;
|
72 | 75 | if (filename) {
|
73 | 76 | file = fs.readFileSync(filename).toString();
|
@@ -96,6 +99,7 @@ program
|
96 | 99 | .command("host [filename]")
|
97 | 100 | .description("Host a file on a local Websocket/HTTP server using a server-side Perspective. Reads from STDIN if no filename is provided")
|
98 | 101 | .option("-p, --port <port>", "Which port to bind to.", x => parseInt(x), 8080)
|
| 102 | + .option("-a, --assets <path>", "Host from a working directory") |
99 | 103 | .option("-o, --open", "Open a browser automagically.")
|
100 | 104 | .action(host);
|
101 | 105 |
|
|
0 commit comments