mirrorbook 0.7.0 → 0.8.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 +13 -8
- package/package.json +9 -8
package/dist/cli.js
CHANGED
|
@@ -448,6 +448,8 @@ function createClient(apiUrl, token) {
|
|
|
448
448
|
),
|
|
449
449
|
deviceToken: (deviceCode) => call("POST", "/cli/device/token", { deviceCode }),
|
|
450
450
|
deploy: (form) => call("POST", "/deploy", form),
|
|
451
|
+
// HTML 直接用 JSON 发布:{html, slug?, title?, onConflict?};返回 url 和 live(202 时还在处理中)
|
|
452
|
+
deployHtml: (body) => call("POST", "/deploy/html", body),
|
|
451
453
|
sites: () => call("GET", "/sites"),
|
|
452
454
|
site: (slug) => call("GET", `/sites/${encodeURIComponent(slug)}`),
|
|
453
455
|
deployment: (id) => call("GET", `/deployments/${encodeURIComponent(id)}`),
|
|
@@ -562,7 +564,7 @@ import { fileURLToPath } from "url";
|
|
|
562
564
|
// package.json
|
|
563
565
|
var package_default = {
|
|
564
566
|
name: "mirrorbook",
|
|
565
|
-
version: "0.
|
|
567
|
+
version: "0.8.0",
|
|
566
568
|
description: "Publish HTML to a shareable URL. Agent-friendly: non-interactive, --json output, stable exit codes.",
|
|
567
569
|
type: "module",
|
|
568
570
|
bin: {
|
|
@@ -933,13 +935,16 @@ program.command("deploy").description("Publish a directory, .zip, .html, .md, or
|
|
|
933
935
|
const coverSvg = o.cover ? await readCover(o.cover) : void 0;
|
|
934
936
|
const api = await client();
|
|
935
937
|
const { blob, name, files, format } = await pack(input, o.format);
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
938
|
+
const onConflict = o.strictSlug ? "error" : void 0;
|
|
939
|
+
const res = format === "html" ? await api.deployHtml({ html: await blob.text(), slug: o.slug, title: o.title, onConflict }) : await (() => {
|
|
940
|
+
const form = new FormData();
|
|
941
|
+
form.set("file", blob, name);
|
|
942
|
+
if (format) form.set("format", format);
|
|
943
|
+
if (o.slug) form.set("slug", o.slug);
|
|
944
|
+
if (o.title) form.set("title", o.title);
|
|
945
|
+
if (onConflict) form.set("onConflict", onConflict);
|
|
946
|
+
return api.deploy(form);
|
|
947
|
+
})();
|
|
943
948
|
const { created, requestedSlug, slugAdjusted } = res;
|
|
944
949
|
let { site, deployment } = res;
|
|
945
950
|
site = await applyAccess(api, site.slug, o) ?? site;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mirrorbook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Publish HTML to a shareable URL. Agent-friendly: non-interactive, --json output, stable exit codes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,16 +14,17 @@
|
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=20"
|
|
16
16
|
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "tsx src/cli.ts",
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"typecheck": "tsc -p .",
|
|
21
|
+
"prepack": "tsup"
|
|
22
|
+
},
|
|
17
23
|
"devDependencies": {
|
|
18
|
-
"@mirrorbook/shared": "
|
|
24
|
+
"@mirrorbook/shared": "workspace:*"
|
|
19
25
|
},
|
|
20
26
|
"dependencies": {
|
|
21
27
|
"commander": "^15.0.0",
|
|
22
28
|
"fflate": "^0.8.3"
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"dev": "tsx src/cli.ts",
|
|
26
|
-
"build": "tsup",
|
|
27
|
-
"typecheck": "tsc -p ."
|
|
28
29
|
}
|
|
29
|
-
}
|
|
30
|
+
}
|