mdts 0.3.2 → 0.4.0
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/dist/cli.js +33 -19
- package/dist/frontend/bundle.js +1521 -1444
- package/{public → dist/frontend}/index.html +1 -1
- package/dist/index.js +4 -2
- package/dist/server/public/logo.svg +32 -0
- package/{public → dist/server/public}/welcome.md +1 -1
- package/dist/server/routes/filetree.js +14 -7
- package/dist/server/routes/outline.js +17 -13
- package/dist/server/server.js +49 -34
- package/package.json +21 -33
- /package/{public → dist/frontend}/favicon.ico +0 -0
- /package/{public → dist/frontend}/logo.svg +0 -0
- /package/{public → dist/frontend}/markdown.css +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CLI = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const server_1 = require("./server/server");
|
|
6
11
|
const DEFAULT_PORT = 8521;
|
|
7
12
|
const DEFAULT_DIRECTORY = '.';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
13
|
+
class CLI {
|
|
14
|
+
run() {
|
|
15
|
+
return this.requireOpen()
|
|
16
|
+
.then((open) => {
|
|
17
|
+
const program = new commander_1.Command();
|
|
18
|
+
program
|
|
19
|
+
.option('-p, --port <port>', 'Port to serve on', String(DEFAULT_PORT))
|
|
20
|
+
.argument('[directory]', 'Directory to serve', DEFAULT_DIRECTORY)
|
|
21
|
+
.action((directory, options) => {
|
|
22
|
+
const port = parseInt(options.port, 10);
|
|
23
|
+
(0, server_1.serve)(directory, port);
|
|
24
|
+
const readmePath = path_1.default.join(directory, 'README.md');
|
|
25
|
+
const initialPath = (0, fs_1.existsSync)(readmePath) ? '/README.md' : '';
|
|
26
|
+
open(`http://localhost:${port}${initialPath}`);
|
|
27
|
+
});
|
|
28
|
+
program.parse(process.argv);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
requireOpen() {
|
|
32
|
+
return import('open').then((module) => module.default);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.CLI = CLI;
|