markmap-cli 0.18.5 → 0.18.7
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/index.js +7 -5
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { watch } from "chokidar";
|
|
|
14
14
|
import { createHash } from "crypto";
|
|
15
15
|
import { createReadStream, createWriteStream } from "fs";
|
|
16
16
|
import { Hono } from "hono";
|
|
17
|
+
import { getPortPromise } from "portfinder";
|
|
17
18
|
import { Readable } from "stream";
|
|
18
19
|
import { finished } from "stream/promises";
|
|
19
20
|
var getMimeType = (filename, mimes = baseMimes) => {
|
|
@@ -338,7 +339,7 @@ class MarkmapDevServer {
|
|
|
338
339
|
const server = serve(
|
|
339
340
|
{
|
|
340
341
|
fetch: app.fetch,
|
|
341
|
-
port: this.options.port
|
|
342
|
+
port: this.options.port || await getPortPromise()
|
|
342
343
|
},
|
|
343
344
|
deferred.resolve
|
|
344
345
|
);
|
|
@@ -535,13 +536,13 @@ async function main() {
|
|
|
535
536
|
const notifier = updateNotifier({ pkg });
|
|
536
537
|
notifier.notify();
|
|
537
538
|
const program = new Command();
|
|
538
|
-
program.version(pkg.version).description("Create a markmap from a Markdown input file").arguments("<input>").option("--no-open", "
|
|
539
|
+
program.version(pkg.version).description("Create a markmap from a Markdown input file").arguments("<input>").option("--no-open", "Do not open the output file after generation").option("--no-toolbar", "Do not show toolbar").option("-o, --output <output>", "Specify the filename of the output HTML").option(
|
|
539
540
|
"--offline",
|
|
540
541
|
"Inline all assets to allow the generated HTML to work offline"
|
|
541
542
|
).option(
|
|
542
543
|
"-w, --watch",
|
|
543
|
-
"
|
|
544
|
-
).action(async (input, cmd) => {
|
|
544
|
+
"Watch the input file and update output on the fly, note that this feature is for development only"
|
|
545
|
+
).option("--port <port>", "Set the port for the devServer to listen").action(async (input, cmd) => {
|
|
545
546
|
let { offline } = cmd;
|
|
546
547
|
if (cmd.watch) offline = true;
|
|
547
548
|
if (offline) await fetchAssets();
|
|
@@ -550,7 +551,8 @@ async function main() {
|
|
|
550
551
|
if (cmd.watch) {
|
|
551
552
|
const devServer = await develop({
|
|
552
553
|
toolbar: cmd.toolbar,
|
|
553
|
-
offline
|
|
554
|
+
offline,
|
|
555
|
+
port: +cmd.port || void 0
|
|
554
556
|
});
|
|
555
557
|
const address = devServer.serverInfo.address;
|
|
556
558
|
const provider = devServer.addProvider({ filePath: input });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
4
4
|
"description": "Create markmaps from CLI",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,8 +54,9 @@
|
|
|
54
54
|
"markmap-render": "0.18.5",
|
|
55
55
|
"markmap-toolbar": "0.18.5",
|
|
56
56
|
"open": "^10.1.0",
|
|
57
|
+
"portfinder": "^1.0.32",
|
|
57
58
|
"read-package-up": "^11.0.0",
|
|
58
59
|
"update-notifier": "^7.3.1"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "2f26340e48545f181ca6e887b9fcfddb2b5ae6cb"
|
|
61
62
|
}
|