gutterpress 0.11.8 → 0.11.9-alpha.2
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/api/index.d.ts +1 -0
- package/dist/api/index.js +5 -1
- package/dist/{audit-p2t6e05h.js → audit-r795rt10.js} +3 -3
- package/dist/{build-10swrj1z.js → build-m0w386vr.js} +3 -3
- package/dist/{cli-481qh6f0.js → cli-5fa9m71c.js} +1 -1
- package/dist/{cli-8xagm379.js → cli-64n9m3k8.js} +4 -2
- package/dist/{cli-1hmenj11.js → cli-vrnrsetc.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/{doctor-jvvb5ewf.js → doctor-jkbr9jxr.js} +2 -2
- package/dist/{ext-p9488y4j.js → ext-qxr9fc0z.js} +3 -3
- package/dist/{index-9nhdagfx.js → index-6dr6dn95.js} +122 -40
- package/dist/index.js +5 -1
- package/dist/lib/remote-auth/repair.d.ts +20 -0
- package/dist/lib/remote-auth/sync-messages.d.ts +3 -3
- package/dist/lib/remote-auth/test-support/sync-harness.d.ts +22 -0
- package/dist/{lint-bvdfs5sr.js → lint-9szyedkb.js} +3 -3
- package/dist/{new-w29tx3gk.js → new-qvqnw4dv.js} +3 -3
- package/dist/{preflight-2hgd39c8.js → preflight-nppgkakz.js} +3 -3
- package/dist/{preview-eqyhmd48.js → preview-zjt2mcj9.js} +3 -3
- package/dist/{publish-9qmnx6d3.js → publish-mp6zj0x2.js} +3 -3
- package/dist/{validate-vwqs5s00.js → validate-m5b73vz6.js} +3 -3
- package/package.json +1 -1
package/dist/api/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export type { GenericTokenConnectInput, GenericAuthOptions, } from "../lib/remot
|
|
|
71
71
|
export { diagnoseProjectRemote, parseRemoteOrigin, forgeKindForHost, } from "../lib/remote-auth/diagnose.ts";
|
|
72
72
|
export type { ProjectRemoteDiagnosis, DiagnoseProjectRemoteOptions, RemoteProtocol, RemoteGuidanceId, ForgeKind, } from "../lib/remote-auth/diagnose.ts";
|
|
73
73
|
export { syncProject, refreshRemoteCopies, SYNC_SNAPSHOT_MESSAGE, } from "../lib/remote-auth/sync.ts";
|
|
74
|
+
export { repairOnlineBackup, REPAIR_SNAPSHOT_MESSAGE, type RepairOnlineBackupOptions, type RepairOnlineBackupResult, } from "../lib/remote-auth/repair.ts";
|
|
74
75
|
export type { SyncOutcome, SyncProjectOptions, KeptBothFile, } from "../lib/remote-auth/sync.ts";
|
|
75
76
|
export type { SnapshotEntry, InitVersionHistoryOptions, SnapshotOptions, RestoreSnapshotOptions, RestoreVersionOptions, RestoreVersionResult, SourceProvider, } from "../lib/source-provider.ts";
|
|
76
77
|
export { runPublish, resolvePublishRequest, resolvePublishFormat, } from "../lib/publish/run-publish.ts";
|
package/dist/api/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
PRESET_IDS,
|
|
23
23
|
PublishSelectionsStore,
|
|
24
24
|
RECOMMENDED_EXTENSIONS,
|
|
25
|
+
REPAIR_SNAPSHOT_MESSAGE,
|
|
25
26
|
RESERVED_PREFIX,
|
|
26
27
|
SEARCH_KEYWORDS,
|
|
27
28
|
SNIPPETS_DIR,
|
|
@@ -91,6 +92,7 @@ import {
|
|
|
91
92
|
refreshRemoteCopies,
|
|
92
93
|
removeExtension,
|
|
93
94
|
reorderExtensions,
|
|
95
|
+
repairOnlineBackup,
|
|
94
96
|
requireGoogleClientCredentials,
|
|
95
97
|
resolveActiveStyles,
|
|
96
98
|
resolveConfig,
|
|
@@ -122,7 +124,7 @@ import {
|
|
|
122
124
|
syncProject,
|
|
123
125
|
testRemoteAccess,
|
|
124
126
|
validateProjectExtensions
|
|
125
|
-
} from "../index-
|
|
127
|
+
} from "../index-6dr6dn95.js";
|
|
126
128
|
import {
|
|
127
129
|
BuildError,
|
|
128
130
|
DEFAULT_PRINT_OPTS,
|
|
@@ -191,6 +193,7 @@ export {
|
|
|
191
193
|
requireGoogleClientCredentials,
|
|
192
194
|
repoSubPath,
|
|
193
195
|
repoRootForSource,
|
|
196
|
+
repairOnlineBackup,
|
|
194
197
|
reorderExtensions,
|
|
195
198
|
removeExtension,
|
|
196
199
|
refreshRemoteCopies,
|
|
@@ -271,6 +274,7 @@ export {
|
|
|
271
274
|
SEARCH_KEYWORDS,
|
|
272
275
|
RESTORE_BACKUP_MESSAGE,
|
|
273
276
|
RESERVED_PREFIX,
|
|
277
|
+
REPAIR_SNAPSHOT_MESSAGE,
|
|
274
278
|
RECOMMENDED_EXTENSIONS,
|
|
275
279
|
PublishSelectionsStore,
|
|
276
280
|
PRESET_IDS,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeAndReport
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-64n9m3k8.js";
|
|
4
4
|
import {
|
|
5
5
|
log
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-vrnrsetc.js";
|
|
7
7
|
import {
|
|
8
8
|
UsageError,
|
|
9
9
|
rejectExtraPositionals,
|
|
10
10
|
rejectUnknownFlags
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-5fa9m71c.js";
|
|
12
12
|
import"./cli-h91e69hm.js";
|
|
13
13
|
import"./cli-c41yr7he.js";
|
|
14
14
|
import {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runBuild,
|
|
3
3
|
splitOutPath
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-64n9m3k8.js";
|
|
5
5
|
import {
|
|
6
6
|
log
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-vrnrsetc.js";
|
|
8
8
|
import {
|
|
9
9
|
UsageError,
|
|
10
10
|
parseFormat,
|
|
11
11
|
parsePdfxFlavor,
|
|
12
12
|
rejectExtraPositionals,
|
|
13
13
|
rejectUnknownFlags
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-5fa9m71c.js";
|
|
15
15
|
import"./cli-h91e69hm.js";
|
|
16
16
|
import"./cli-c41yr7he.js";
|
|
17
17
|
import {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "gutterpress",
|
|
7
|
-
version: "0.11.
|
|
7
|
+
version: "0.11.9-alpha.2",
|
|
8
8
|
description: "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
|
|
9
9
|
author: "itlackey",
|
|
10
10
|
license: "MPL-2.0",
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
stampCreator,
|
|
14
14
|
stripAnnotations,
|
|
15
15
|
warn
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-vrnrsetc.js";
|
|
17
17
|
import {
|
|
18
18
|
DEBOUNCE,
|
|
19
19
|
UsageError,
|
|
20
20
|
resolvePort
|
|
21
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-5fa9m71c.js";
|
|
22
22
|
import {
|
|
23
23
|
MARGIN_BOX_IGNORED_PROPERTIES,
|
|
24
24
|
RENDER_TIMEOUT_MS,
|
|
@@ -13541,6 +13541,8 @@ import git6 from "isomorphic-git";
|
|
|
13541
13541
|
// src/lib/remote-auth/converge-merge.ts
|
|
13542
13542
|
import git5 from "isomorphic-git";
|
|
13543
13543
|
import diff3Merge from "diff3";
|
|
13544
|
+
// src/lib/remote-auth/repair.ts
|
|
13545
|
+
import git7 from "isomorphic-git";
|
|
13544
13546
|
// src/lib/publish/selections.ts
|
|
13545
13547
|
import { chmod as chmod2, mkdir as mkdir13, readFile as readFile30, writeFile as writeFile12 } from "node:fs/promises";
|
|
13546
13548
|
import path23 from "node:path";
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
UsageError,
|
|
7
7
|
package_default,
|
|
8
8
|
rejectUnknownFlags
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-5fa9m71c.js";
|
|
10
10
|
import {
|
|
11
11
|
EXIT_CODES
|
|
12
12
|
} from "./cli-46ycxe6r.js";
|
|
@@ -18,16 +18,16 @@ import {
|
|
|
18
18
|
import { defineCommand, parseArgs, runMain } from "citty";
|
|
19
19
|
import { statSync } from "node:fs";
|
|
20
20
|
var SUBCOMMANDS = {
|
|
21
|
-
new: () => import("./new-
|
|
22
|
-
preview: () => import("./preview-
|
|
23
|
-
build: () => import("./build-
|
|
24
|
-
publish: () => import("./publish-
|
|
25
|
-
lint: () => import("./lint-
|
|
26
|
-
validate: () => import("./validate-
|
|
27
|
-
audit: () => import("./audit-
|
|
28
|
-
preflight: () => import("./preflight-
|
|
29
|
-
doctor: () => import("./doctor-
|
|
30
|
-
ext: () => import("./ext-
|
|
21
|
+
new: () => import("./new-qvqnw4dv.js").then((m) => m.default),
|
|
22
|
+
preview: () => import("./preview-zjt2mcj9.js").then((m) => m.default),
|
|
23
|
+
build: () => import("./build-m0w386vr.js").then((m) => m.default),
|
|
24
|
+
publish: () => import("./publish-mp6zj0x2.js").then((m) => m.default),
|
|
25
|
+
lint: () => import("./lint-9szyedkb.js").then((m) => m.default),
|
|
26
|
+
validate: () => import("./validate-m5b73vz6.js").then((m) => m.default),
|
|
27
|
+
audit: () => import("./audit-r795rt10.js").then((m) => m.default),
|
|
28
|
+
preflight: () => import("./preflight-nppgkakz.js").then((m) => m.default),
|
|
29
|
+
doctor: () => import("./doctor-jkbr9jxr.js").then((m) => m.default),
|
|
30
|
+
ext: () => import("./ext-qxr9fc0z.js").then((m) => m.default)
|
|
31
31
|
};
|
|
32
32
|
var VERSION = package_default.version;
|
|
33
33
|
var main = defineCommand({
|
|
@@ -52,7 +52,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
52
52
|
const [command, ...commandArgs] = rawArgs;
|
|
53
53
|
try {
|
|
54
54
|
if (command === "new") {
|
|
55
|
-
const { newArgs } = await import("./new-
|
|
55
|
+
const { newArgs } = await import("./new-qvqnw4dv.js");
|
|
56
56
|
rejectUnknownFlags(commandArgs, newArgs, "new");
|
|
57
57
|
const parsed = parseArgs(commandArgs, {
|
|
58
58
|
...newArgs,
|
|
@@ -64,7 +64,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
if (command === "preflight") {
|
|
67
|
-
const { preflightArgs } = await import("./preflight-
|
|
67
|
+
const { preflightArgs } = await import("./preflight-nppgkakz.js");
|
|
68
68
|
rejectUnknownFlags(commandArgs, preflightArgs, "preflight");
|
|
69
69
|
const parsed = parseArgs(commandArgs, {
|
|
70
70
|
...preflightArgs,
|
|
@@ -84,7 +84,7 @@ async function preflightRequiredInvocations(rawArgs) {
|
|
|
84
84
|
}
|
|
85
85
|
if (subcommand.startsWith("-"))
|
|
86
86
|
return;
|
|
87
|
-
const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-
|
|
87
|
+
const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-qxr9fc0z.js");
|
|
88
88
|
if (!EXT_SUBCOMMANDS.includes(subcommand)) {
|
|
89
89
|
throw new UsageError(`gutterpress ext: unknown command "${subcommand}"`);
|
|
90
90
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSystemDiagnostics,
|
|
3
3
|
log
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-vrnrsetc.js";
|
|
5
5
|
import {
|
|
6
6
|
UsageError,
|
|
7
7
|
rejectExtraPositionals,
|
|
8
8
|
rejectUnknownFlags
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-5fa9m71c.js";
|
|
10
10
|
import"./cli-c41yr7he.js";
|
|
11
11
|
import"./cli-46ycxe6r.js";
|
|
12
12
|
import"./cli-37x76zdn.js";
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
removeExtension,
|
|
11
11
|
searchNpmExtensions,
|
|
12
12
|
setExtensionEnabled
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import"./cli-
|
|
13
|
+
} from "./cli-64n9m3k8.js";
|
|
14
|
+
import"./cli-vrnrsetc.js";
|
|
15
15
|
import {
|
|
16
16
|
UsageError,
|
|
17
17
|
exitForUsage,
|
|
18
18
|
rejectExtraPositionals,
|
|
19
19
|
rejectUnknownFlags,
|
|
20
20
|
resolveProjectDir
|
|
21
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-5fa9m71c.js";
|
|
22
22
|
import"./cli-h91e69hm.js";
|
|
23
23
|
import"./cli-c41yr7he.js";
|
|
24
24
|
import {
|
|
@@ -652,8 +652,8 @@ var MSG_OFFLINE = "Your changes are saved on this computer. gutterpress couldn't
|
|
|
652
652
|
var MSG_AUTH = "The online repository didn't accept the saved connection. Reconnect and try again.";
|
|
653
653
|
var MSG_INSECURE_TRANSPORT = "This book's online address isn't secure, so the saved connection wasn't sent — connections are never sent over an insecure address. Switch the address to a secure one (starting with https), or to a local loopback address for a server on this computer, to sync.";
|
|
654
654
|
var MSG_BUSY = "The online copy is changing very quickly right now. Your work is saved on this computer — try Sync again in a moment.";
|
|
655
|
-
var MSG_HISTORY_UNREADABLE = "This book's version history can't be read, so syncing can't continue. Your writing is safe — every file is still here on this computer.
|
|
656
|
-
var MSG_UNRELATED = "This book and the online copy have no history in common, so they can't be combined. Either the online address points at a different book, or this book's own history was lost and started over. Your writing is safe — every file is still here on this computer. Check the online address; if it is correct,
|
|
655
|
+
var MSG_HISTORY_UNREADABLE = "This book's version history can't be read, so syncing can't continue. Your writing is safe — every file is still here on this computer. Use Repair online backup (in Where your work is kept) to get history and syncing working again.";
|
|
656
|
+
var MSG_UNRELATED = "This book and the online copy have no history in common, so they can't be combined. Either the online address points at a different book, or this book's own history was lost and started over. Your writing is safe — every file is still here on this computer. Check the online address; if it is correct, use Repair online backup (in Where your work is kept).";
|
|
657
657
|
var MSG_NO_REMOTE = "This book isn't connected to an online repository yet.";
|
|
658
658
|
var MSG_SSH_REMOTE = "This book's online address uses SSH (git@…), which gutterpress can't sync to. Switch it to the web (HTTPS) address to sync from here.";
|
|
659
659
|
var MSG_NO_BRANCH = "This book's version history isn't on a named branch, so it can't be synced right now.";
|
|
@@ -4301,7 +4301,7 @@ import git from "isomorphic-git";
|
|
|
4301
4301
|
// package.json
|
|
4302
4302
|
var package_default = {
|
|
4303
4303
|
name: "gutterpress",
|
|
4304
|
-
version: "0.11.
|
|
4304
|
+
version: "0.11.9-alpha.2",
|
|
4305
4305
|
description: "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
|
|
4306
4306
|
author: "itlackey",
|
|
4307
4307
|
license: "MPL-2.0",
|
|
@@ -14453,13 +14453,14 @@ function isUnrelatedHistories(e) {
|
|
|
14453
14453
|
return code === "UnrelatedHistoriesError" || /unrelated histories|no common commits|refusing to merge unrelated/i.test(msg);
|
|
14454
14454
|
}
|
|
14455
14455
|
function isDamagedObjectError(e) {
|
|
14456
|
-
return e instanceof TypeError && /property 'caller' on string|^Attempted to assign to readonly property\.$/.test(e.message);
|
|
14456
|
+
return e instanceof TypeError && /property 'caller' on string|^Attempted to assign to readonly property\.$/.test(e.message) || e?.code === "NotFoundError";
|
|
14457
14457
|
}
|
|
14458
14458
|
async function historyUnreadable(dir) {
|
|
14459
14459
|
try {
|
|
14460
14460
|
const oid = await git6.resolveRef({ fs: gitFs, dir, ref: "HEAD" });
|
|
14461
14461
|
await git6.readCommit({ fs: gitFs, dir, oid });
|
|
14462
14462
|
await git6.listFiles({ fs: gitFs, dir });
|
|
14463
|
+
await git6.listFiles({ fs: gitFs, dir, ref: "HEAD" });
|
|
14463
14464
|
return false;
|
|
14464
14465
|
} catch {
|
|
14465
14466
|
return true;
|
|
@@ -14665,7 +14666,7 @@ async function syncProject(options) {
|
|
|
14665
14666
|
const setupMsg = setupErrorMessage(e);
|
|
14666
14667
|
if (setupMsg)
|
|
14667
14668
|
return { status: "error", message: setupMsg, ...base() };
|
|
14668
|
-
if (isDamagedObjectError(e) || await historyUnreadable(dir)) {
|
|
14669
|
+
if (stage !== "fetch" && isDamagedObjectError(e) || await historyUnreadable(dir)) {
|
|
14669
14670
|
logger.error("sync", "the book's history could not be read");
|
|
14670
14671
|
return { status: "error", message: MSG_HISTORY_UNREADABLE, ...base() };
|
|
14671
14672
|
}
|
|
@@ -14711,9 +14712,90 @@ async function refreshRemoteCopies(options) {
|
|
|
14711
14712
|
return { refreshed: false, reason: "offline" };
|
|
14712
14713
|
}
|
|
14713
14714
|
}
|
|
14715
|
+
// src/lib/remote-auth/repair.ts
|
|
14716
|
+
import git7 from "isomorphic-git";
|
|
14717
|
+
import { cp as cp6, mkdir as mkdir16, rename as rename5, rm as rm8 } from "node:fs/promises";
|
|
14718
|
+
import path24 from "node:path";
|
|
14719
|
+
var REPAIR_SNAPSHOT_MESSAGE = "Repaired online backup";
|
|
14720
|
+
async function moveDir(from, to) {
|
|
14721
|
+
await mkdir16(path24.dirname(to), { recursive: true });
|
|
14722
|
+
try {
|
|
14723
|
+
await rename5(from, to);
|
|
14724
|
+
} catch (e) {
|
|
14725
|
+
if (e.code !== "EXDEV")
|
|
14726
|
+
throw e;
|
|
14727
|
+
await cp6(from, to, { recursive: true });
|
|
14728
|
+
await rm8(from, { recursive: true, force: true });
|
|
14729
|
+
}
|
|
14730
|
+
}
|
|
14731
|
+
async function repairOnlineBackup(options) {
|
|
14732
|
+
const logger = resolveLogger(options.logFile, "repair");
|
|
14733
|
+
const dir = await repoDirFor(options.projectDir);
|
|
14734
|
+
const oldGit = path24.join(dir, ".git");
|
|
14735
|
+
const movedGitTo = path24.join(options.backupDir, "git");
|
|
14736
|
+
const freshDir = path24.join(options.backupDir, "fresh-clone");
|
|
14737
|
+
const { restoredFiles, credential } = await withRepoLock(dir, async () => {
|
|
14738
|
+
const transport = await resolveTransport(dir, options);
|
|
14739
|
+
let branch;
|
|
14740
|
+
try {
|
|
14741
|
+
branch = await git7.currentBranch({ fs: gitFs, dir }) ?? undefined;
|
|
14742
|
+
} catch {
|
|
14743
|
+
branch = undefined;
|
|
14744
|
+
}
|
|
14745
|
+
logger.info("download", "starting", { remote: transport.remote, branch: branch ?? "default" });
|
|
14746
|
+
const fresh = await cloneRepository({
|
|
14747
|
+
url: transport.url,
|
|
14748
|
+
dir: freshDir,
|
|
14749
|
+
...transport.credential ? { credential: transport.credential } : {},
|
|
14750
|
+
...branch ? { branch } : {},
|
|
14751
|
+
tokenStore: options.tokenStore,
|
|
14752
|
+
httpClient: options.httpClient
|
|
14753
|
+
});
|
|
14754
|
+
logger.info("swap", "moving old history aside", { to: movedGitTo });
|
|
14755
|
+
await moveDir(oldGit, movedGitTo);
|
|
14756
|
+
try {
|
|
14757
|
+
await moveDir(path24.join(freshDir, ".git"), oldGit);
|
|
14758
|
+
} catch (e) {
|
|
14759
|
+
await rm8(oldGit, { recursive: true, force: true });
|
|
14760
|
+
await moveDir(movedGitTo, oldGit);
|
|
14761
|
+
throw e;
|
|
14762
|
+
}
|
|
14763
|
+
await rm8(freshDir, { recursive: true, force: true });
|
|
14764
|
+
const ref = fresh.branch ?? "HEAD";
|
|
14765
|
+
let missing = [];
|
|
14766
|
+
try {
|
|
14767
|
+
const tracked = await git7.listFiles({ fs: gitFs, dir, ref });
|
|
14768
|
+
missing = tracked.filter((f) => !gitFs.existsSync(path24.join(dir, f)));
|
|
14769
|
+
if (missing.length > 0) {
|
|
14770
|
+
await git7.checkout({ fs: gitFs, dir, ref, filepaths: missing, force: true });
|
|
14771
|
+
logger.info("restore", "restored files missing on this computer", { files: missing });
|
|
14772
|
+
}
|
|
14773
|
+
} catch (e) {
|
|
14774
|
+
logger.warn("restore", "could not restore every online-only file", errorLogData(e));
|
|
14775
|
+
missing = [];
|
|
14776
|
+
}
|
|
14777
|
+
return { restoredFiles: missing, credential: transport.credential };
|
|
14778
|
+
}).catch((e) => {
|
|
14779
|
+
logger.error("repair", "repair failed", errorLogData(e));
|
|
14780
|
+
throw e;
|
|
14781
|
+
});
|
|
14782
|
+
const outcome = await syncProject({
|
|
14783
|
+
projectDir: options.projectDir,
|
|
14784
|
+
credential,
|
|
14785
|
+
tokenStore: options.tokenStore,
|
|
14786
|
+
authorName: options.authorName,
|
|
14787
|
+
authorEmail: options.authorEmail,
|
|
14788
|
+
logFile: options.logFile,
|
|
14789
|
+
httpClient: options.httpClient,
|
|
14790
|
+
message: REPAIR_SNAPSHOT_MESSAGE,
|
|
14791
|
+
push: true
|
|
14792
|
+
});
|
|
14793
|
+
logger.info("result", "repair complete", { status: outcome.status, restored: restoredFiles.length });
|
|
14794
|
+
return { outcome, movedGitTo, restoredFiles };
|
|
14795
|
+
}
|
|
14714
14796
|
// src/lib/publish/run-publish.ts
|
|
14715
14797
|
import { readdir as readdir10, stat as stat11 } from "node:fs/promises";
|
|
14716
|
-
import
|
|
14798
|
+
import path28 from "node:path";
|
|
14717
14799
|
|
|
14718
14800
|
// src/lib/publish/command-runner.ts
|
|
14719
14801
|
var CAPTURE_LIMIT = 64 * 1024;
|
|
@@ -14862,25 +14944,25 @@ ${tail}` : ""}`);
|
|
|
14862
14944
|
};
|
|
14863
14945
|
|
|
14864
14946
|
// src/lib/publish/providers/guided.ts
|
|
14865
|
-
import { copyFile as copyFile2, mkdir as
|
|
14866
|
-
import
|
|
14947
|
+
import { copyFile as copyFile2, mkdir as mkdir17, writeFile as writeFile14 } from "node:fs/promises";
|
|
14948
|
+
import path25 from "node:path";
|
|
14867
14949
|
async function stageGuidedPackage(req, providerId, listingLines) {
|
|
14868
|
-
const packageDir =
|
|
14869
|
-
await
|
|
14870
|
-
await copyFile2(req.artifact.path,
|
|
14950
|
+
const packageDir = path25.join(path25.dirname(req.artifact.path), "publish", providerId);
|
|
14951
|
+
await mkdir17(packageDir, { recursive: true });
|
|
14952
|
+
await copyFile2(req.artifact.path, path25.join(packageDir, path25.basename(req.artifact.path)));
|
|
14871
14953
|
const { title, authors } = req.project;
|
|
14872
14954
|
const sheet = [
|
|
14873
14955
|
`# ${title || "Untitled"}`,
|
|
14874
14956
|
"",
|
|
14875
14957
|
`- **Authors:** ${authors.length ? authors.join(", ") : "(not set)"}`,
|
|
14876
|
-
`- **File:** ${
|
|
14958
|
+
`- **File:** ${path25.basename(req.artifact.path)}`,
|
|
14877
14959
|
...listingLines,
|
|
14878
14960
|
"",
|
|
14879
14961
|
"Copy these details into the platform's listing form when uploading.",
|
|
14880
14962
|
""
|
|
14881
14963
|
].join(`
|
|
14882
14964
|
`);
|
|
14883
|
-
await writeFile14(
|
|
14965
|
+
await writeFile14(path25.join(packageDir, "LISTING.md"), sheet, "utf8");
|
|
14884
14966
|
return packageDir;
|
|
14885
14967
|
}
|
|
14886
14968
|
|
|
@@ -14943,9 +15025,9 @@ var drivethrurpgProvider = {
|
|
|
14943
15025
|
};
|
|
14944
15026
|
|
|
14945
15027
|
// src/lib/publish/providers/gdrive.ts
|
|
14946
|
-
import { mkdtemp as mkdtemp4, readFile as readFile33, readdir as readdir9, rm as
|
|
15028
|
+
import { mkdtemp as mkdtemp4, readFile as readFile33, readdir as readdir9, rm as rm9, stat as stat9, writeFile as writeFile15 } from "node:fs/promises";
|
|
14947
15029
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
14948
|
-
import
|
|
15030
|
+
import path26 from "node:path";
|
|
14949
15031
|
import { Zip, ZipDeflate } from "fflate";
|
|
14950
15032
|
|
|
14951
15033
|
// src/lib/publish/google-drive.ts
|
|
@@ -15330,24 +15412,24 @@ function zipEntriesNonBlocking(entries, opts) {
|
|
|
15330
15412
|
async function collectZipEntries(root, dir, out, onWarn) {
|
|
15331
15413
|
const entries = await readdir9(dir, { withFileTypes: true });
|
|
15332
15414
|
for (const entry of entries) {
|
|
15333
|
-
const full =
|
|
15415
|
+
const full = path26.join(dir, entry.name);
|
|
15334
15416
|
if (entry.isDirectory()) {
|
|
15335
15417
|
await collectZipEntries(root, full, out, onWarn);
|
|
15336
15418
|
} else if (entry.isFile()) {
|
|
15337
|
-
const rel =
|
|
15419
|
+
const rel = path26.relative(root, full).split(path26.sep).join("/");
|
|
15338
15420
|
out[rel] = await readFile33(full);
|
|
15339
15421
|
} else if (entry.isSymbolicLink()) {
|
|
15340
15422
|
const resolved = await stat9(full).catch(() => null);
|
|
15341
15423
|
if (resolved?.isFile()) {
|
|
15342
|
-
const rel =
|
|
15424
|
+
const rel = path26.relative(root, full).split(path26.sep).join("/");
|
|
15343
15425
|
out[rel] = await readFile33(full);
|
|
15344
15426
|
} else if (resolved?.isDirectory()) {
|
|
15345
15427
|
await collectZipEntries(root, full, out, onWarn);
|
|
15346
15428
|
} else {
|
|
15347
|
-
onWarn?.(`Skipped "${
|
|
15429
|
+
onWarn?.(`Skipped "${path26.relative(root, full)}" in the website export — it's a broken symlink.`);
|
|
15348
15430
|
}
|
|
15349
15431
|
} else {
|
|
15350
|
-
onWarn?.(`Skipped "${
|
|
15432
|
+
onWarn?.(`Skipped "${path26.relative(root, full)}" in the website export — not a file, folder, or symlink.`);
|
|
15351
15433
|
}
|
|
15352
15434
|
}
|
|
15353
15435
|
}
|
|
@@ -15355,19 +15437,19 @@ async function zipHtmlExport(exportDir, title, onWarn, writeArchiveImpl = writeF
|
|
|
15355
15437
|
const entries = {};
|
|
15356
15438
|
await collectZipEntries(exportDir, exportDir, entries, onWarn);
|
|
15357
15439
|
const fileName = `${bookSlug(title)}-website.zip`;
|
|
15358
|
-
const tmpRoot = await mkdtemp4(
|
|
15440
|
+
const tmpRoot = await mkdtemp4(path26.join(tmpdir4(), "gutterpress-gdrive-"));
|
|
15359
15441
|
try {
|
|
15360
|
-
const filePath =
|
|
15442
|
+
const filePath = path26.join(tmpRoot, fileName);
|
|
15361
15443
|
const zipped = await zipEntriesNonBlocking(entries, { level: 6 });
|
|
15362
15444
|
await writeArchiveImpl(filePath, zipped);
|
|
15363
15445
|
return {
|
|
15364
15446
|
filePath,
|
|
15365
15447
|
fileName,
|
|
15366
15448
|
mimeType: "application/zip",
|
|
15367
|
-
cleanup: () =>
|
|
15449
|
+
cleanup: () => rm9(tmpRoot, { recursive: true, force: true })
|
|
15368
15450
|
};
|
|
15369
15451
|
} catch (e) {
|
|
15370
|
-
await
|
|
15452
|
+
await rm9(tmpRoot, { recursive: true, force: true }).catch(() => {});
|
|
15371
15453
|
throw e;
|
|
15372
15454
|
}
|
|
15373
15455
|
}
|
|
@@ -15405,7 +15487,7 @@ var gdriveProvider = {
|
|
|
15405
15487
|
const isHtml = req.artifact.format === "html";
|
|
15406
15488
|
const source = isHtml ? await zipHtmlExport(req.artifact.path, req.project.title, (msg) => req.deps.onProgress?.(msg)) : {
|
|
15407
15489
|
filePath: req.artifact.path,
|
|
15408
|
-
fileName:
|
|
15490
|
+
fileName: path26.basename(req.artifact.path),
|
|
15409
15491
|
mimeType: "application/pdf",
|
|
15410
15492
|
cleanup: async () => {}
|
|
15411
15493
|
};
|
|
@@ -15455,8 +15537,8 @@ var gdriveProvider = {
|
|
|
15455
15537
|
};
|
|
15456
15538
|
|
|
15457
15539
|
// src/lib/publish/butler.ts
|
|
15458
|
-
import { chmod as chmod2, mkdir as
|
|
15459
|
-
import
|
|
15540
|
+
import { chmod as chmod2, mkdir as mkdir18, stat as stat10, writeFile as writeFile16 } from "node:fs/promises";
|
|
15541
|
+
import path27 from "node:path";
|
|
15460
15542
|
import { unzipSync as unzipSync2 } from "fflate";
|
|
15461
15543
|
var BUTLER_DOWNLOAD_TIMEOUT_MS = 300000;
|
|
15462
15544
|
function butlerBrothChannel(platform2 = process.platform, arch2 = process.arch) {
|
|
@@ -15493,8 +15575,8 @@ async function ensureButler(deps) {
|
|
|
15493
15575
|
}
|
|
15494
15576
|
if (await commandExists("butler", runCommand, deps.env))
|
|
15495
15577
|
return "butler";
|
|
15496
|
-
const cacheDir =
|
|
15497
|
-
const cached =
|
|
15578
|
+
const cacheDir = path27.join(deps.configDir ?? defaultConfigDir(), "tools", "butler");
|
|
15579
|
+
const cached = path27.join(cacheDir, butlerBinaryName());
|
|
15498
15580
|
if (await fileExists2(cached))
|
|
15499
15581
|
return cached;
|
|
15500
15582
|
const channel = butlerBrothChannel();
|
|
@@ -15516,14 +15598,14 @@ async function ensureButler(deps) {
|
|
|
15516
15598
|
return new Uint8Array(await response.arrayBuffer());
|
|
15517
15599
|
});
|
|
15518
15600
|
const files = unzipSync2(archive);
|
|
15519
|
-
await
|
|
15601
|
+
await mkdir18(cacheDir, { recursive: true });
|
|
15520
15602
|
let foundBinary = false;
|
|
15521
15603
|
for (const [name, data] of Object.entries(files)) {
|
|
15522
15604
|
if (name.endsWith("/"))
|
|
15523
15605
|
continue;
|
|
15524
|
-
const target =
|
|
15606
|
+
const target = path27.join(cacheDir, path27.basename(name));
|
|
15525
15607
|
await writeFile16(target, data);
|
|
15526
|
-
if (
|
|
15608
|
+
if (path27.basename(name) === butlerBinaryName()) {
|
|
15527
15609
|
await chmod2(target, 493).catch(() => {});
|
|
15528
15610
|
foundBinary = true;
|
|
15529
15611
|
}
|
|
@@ -15972,9 +16054,9 @@ async function resolvePublishRequest(options, deps) {
|
|
|
15972
16054
|
const effectiveDeps = effectiveAccount ? { ...deps, credentialAccount: effectiveAccount } : deps;
|
|
15973
16055
|
const outDir = resolveOutputDir(manifestDir, config.title);
|
|
15974
16056
|
const effectiveFormat = resolvePublishFormat(provider.info, providerConfig);
|
|
15975
|
-
const defaultArtifact = effectiveFormat === "pdf" ?
|
|
16057
|
+
const defaultArtifact = effectiveFormat === "pdf" ? path28.join(outDir, artifactName(config.title, "pdf")) : outDir;
|
|
15976
16058
|
const artifact = {
|
|
15977
|
-
path: options.artifactPath ?
|
|
16059
|
+
path: options.artifactPath ? path28.resolve(options.projectDir, options.artifactPath) : defaultArtifact,
|
|
15978
16060
|
format: effectiveFormat
|
|
15979
16061
|
};
|
|
15980
16062
|
return {
|
|
@@ -16038,7 +16120,7 @@ async function artifactIssues(artifact) {
|
|
|
16038
16120
|
var BUILD_FINGERPRINT_FILENAME = "build-fingerprint.json";
|
|
16039
16121
|
async function htmlDirIssues(dir) {
|
|
16040
16122
|
const issues = [];
|
|
16041
|
-
const isThere = async (rel) => stat11(
|
|
16123
|
+
const isThere = async (rel) => stat11(path28.join(dir, rel)).then(() => true, () => false);
|
|
16042
16124
|
if (!await isThere(BOOK_HTML)) {
|
|
16043
16125
|
issues.push({
|
|
16044
16126
|
severity: "error",
|
|
@@ -16157,13 +16239,13 @@ async function disconnectPublishCredential(key, deps, options = {}) {
|
|
|
16157
16239
|
}
|
|
16158
16240
|
}
|
|
16159
16241
|
// src/lib/publish/selections.ts
|
|
16160
|
-
import { chmod as chmod3, mkdir as
|
|
16161
|
-
import
|
|
16242
|
+
import { chmod as chmod3, mkdir as mkdir19, readFile as readFile34, writeFile as writeFile17 } from "node:fs/promises";
|
|
16243
|
+
import path29 from "node:path";
|
|
16162
16244
|
class PublishSelectionsStore {
|
|
16163
16245
|
filePath;
|
|
16164
16246
|
queue = Promise.resolve();
|
|
16165
16247
|
constructor(filePath) {
|
|
16166
|
-
this.filePath = filePath ??
|
|
16248
|
+
this.filePath = filePath ?? path29.join(defaultConfigDir(), "publish-selections.json");
|
|
16167
16249
|
}
|
|
16168
16250
|
async read() {
|
|
16169
16251
|
try {
|
|
@@ -16180,7 +16262,7 @@ class PublishSelectionsStore {
|
|
|
16180
16262
|
return { version: 1, global: {}, projects: {} };
|
|
16181
16263
|
}
|
|
16182
16264
|
async write(data) {
|
|
16183
|
-
await
|
|
16265
|
+
await mkdir19(path29.dirname(this.filePath), { recursive: true });
|
|
16184
16266
|
await writeFile17(this.filePath, JSON.stringify(data, null, 2), {
|
|
16185
16267
|
encoding: "utf8",
|
|
16186
16268
|
mode: 384
|
|
@@ -16283,4 +16365,4 @@ async function setPublishProviderConfig(projectDir, providerId, values) {
|
|
|
16283
16365
|
await writeManifestDoc(file, doc);
|
|
16284
16366
|
return settingsFromDoc(doc);
|
|
16285
16367
|
}
|
|
16286
|
-
export { BUNDLED_EXTENSIONS, isBundledExtension, isPathSpecifier, parseExtensionSpecifier, PRESET_IDS, PRESETS, TARGETS, TARGET_IDS, publishTargetFor, MANIFEST_FILENAMES, hasProjectManifest, loadManifest, loadManifestWithPath, resolveConfig, SYNC_SNAPSHOT_MESSAGE, log, resolveActiveStyles, listProjectStyles, EXTENSION_MANIFEST_FILENAME, readExtensionMeta, extensionStyleList, extensionEntry, extensionCarries, pathEscapesFolder, assertExtensionContained, resolveExtension, loadPluginsWithCss, getChecks, getCheckById, resolveCheckSelectors, formatReport, ruleRemoteUrls, ruleRiskyProps, ruleSyntax, rulePageContainment, checkCss, inspectImage, runChecks, checkToolAvailability, reportMissingTools, executeValidation, executeAndReport, splitOutPath, runBuild, openPath, startPreviewServer, defaultConfigDir, FileTokenStore, extractUrlCredential, getSystemDiagnostics, slugifyProjectName, escapeYamlScalar, scaffoldProject, adoptFolder, ensureGitignoreHasDist, EXTENSION_KINDS, RESERVED_PREFIX, resolveExtensionPrefix, scaffoldExtension, BUILT_IN_TEMPLATE_IDS, listBuiltInTemplates, saveProjectAsTemplate, listCustomTemplates, importTemplateFromFolder, EXTENSIONS_DIR, RECOMMENDED_EXTENSIONS, BUILT_IN_STYLE_SET_IDS, sameExtension, listProjectExtensions, describeExtension, setExtensionEnabled, reorderExtensions, removeExtension, addExtension, listBuiltInStyleSets, addBuiltInStyleSet, validateProjectExtensions, readExtensionCss, SNIPPETS_DIR, extractVariables, substituteVariables, listSnippets, readSnippet, saveSnippet, deleteSnippet, listMergedSnippets, readExtensionSnippet, importExtensionFromFile, importExtensionFromUrl, MAX_SEARCH_BYTES, SEARCH_KEYWORDS, searchNpmExtensions, setManifestFields, readManifestFields, setActiveStyles, AUTO_SNAPSHOT_DEFAULT_MINUTES, AUTO_SYNC_MIN_MINUTES, AUTO_SYNC_MAX_MINUTES, AUTO_SYNC_DEFAULT_MINUTES, AUTO_SYNC_PUSH_INTERVAL_MINUTES, autoSnapshotDelayMs, autoSyncDelayMs, isGitInternalPath, resolveGitHubClientId, GITHUB_HOST, GitHubAuthProvider, GDRIVE_HOST, resolveGoogleClientId, resolveGoogleClientSecret, GOOGLE_NOT_CONFIGURED_MESSAGE, requireGoogleClientCredentials, pkceChallengeFromVerifier, GoogleAuthProvider, revokeGoogleCredential, publishCredentialKey, publishConnectionStatus, listPublishAccounts, connectGoogleDrive, listGitHubRepositories, listRepoBooks, listGitHubBranches, sanitizeCloneFolderName, cloneRepository, isSshRemoteUrl, testRemoteAccess, knownForgeTokenUrl, connectGenericHost, parseRemoteOrigin, forgeKindForHost, diagnoseProjectRemote, syncProject, refreshRemoteCopies, listPublishProviders, publishProviderFor, resolvePublishFormat, resolvePublishRequest, runPublish, connectPublishProvider, disconnectPublishCredential, PublishSelectionsStore, readPublishSettings, setPublishProviderConfig };
|
|
16368
|
+
export { BUNDLED_EXTENSIONS, isBundledExtension, isPathSpecifier, parseExtensionSpecifier, PRESET_IDS, PRESETS, TARGETS, TARGET_IDS, publishTargetFor, MANIFEST_FILENAMES, hasProjectManifest, loadManifest, loadManifestWithPath, resolveConfig, SYNC_SNAPSHOT_MESSAGE, log, resolveActiveStyles, listProjectStyles, EXTENSION_MANIFEST_FILENAME, readExtensionMeta, extensionStyleList, extensionEntry, extensionCarries, pathEscapesFolder, assertExtensionContained, resolveExtension, loadPluginsWithCss, getChecks, getCheckById, resolveCheckSelectors, formatReport, ruleRemoteUrls, ruleRiskyProps, ruleSyntax, rulePageContainment, checkCss, inspectImage, runChecks, checkToolAvailability, reportMissingTools, executeValidation, executeAndReport, splitOutPath, runBuild, openPath, startPreviewServer, defaultConfigDir, FileTokenStore, extractUrlCredential, getSystemDiagnostics, slugifyProjectName, escapeYamlScalar, scaffoldProject, adoptFolder, ensureGitignoreHasDist, EXTENSION_KINDS, RESERVED_PREFIX, resolveExtensionPrefix, scaffoldExtension, BUILT_IN_TEMPLATE_IDS, listBuiltInTemplates, saveProjectAsTemplate, listCustomTemplates, importTemplateFromFolder, EXTENSIONS_DIR, RECOMMENDED_EXTENSIONS, BUILT_IN_STYLE_SET_IDS, sameExtension, listProjectExtensions, describeExtension, setExtensionEnabled, reorderExtensions, removeExtension, addExtension, listBuiltInStyleSets, addBuiltInStyleSet, validateProjectExtensions, readExtensionCss, SNIPPETS_DIR, extractVariables, substituteVariables, listSnippets, readSnippet, saveSnippet, deleteSnippet, listMergedSnippets, readExtensionSnippet, importExtensionFromFile, importExtensionFromUrl, MAX_SEARCH_BYTES, SEARCH_KEYWORDS, searchNpmExtensions, setManifestFields, readManifestFields, setActiveStyles, AUTO_SNAPSHOT_DEFAULT_MINUTES, AUTO_SYNC_MIN_MINUTES, AUTO_SYNC_MAX_MINUTES, AUTO_SYNC_DEFAULT_MINUTES, AUTO_SYNC_PUSH_INTERVAL_MINUTES, autoSnapshotDelayMs, autoSyncDelayMs, isGitInternalPath, resolveGitHubClientId, GITHUB_HOST, GitHubAuthProvider, GDRIVE_HOST, resolveGoogleClientId, resolveGoogleClientSecret, GOOGLE_NOT_CONFIGURED_MESSAGE, requireGoogleClientCredentials, pkceChallengeFromVerifier, GoogleAuthProvider, revokeGoogleCredential, publishCredentialKey, publishConnectionStatus, listPublishAccounts, connectGoogleDrive, listGitHubRepositories, listRepoBooks, listGitHubBranches, sanitizeCloneFolderName, cloneRepository, isSshRemoteUrl, testRemoteAccess, knownForgeTokenUrl, connectGenericHost, parseRemoteOrigin, forgeKindForHost, diagnoseProjectRemote, syncProject, refreshRemoteCopies, REPAIR_SNAPSHOT_MESSAGE, repairOnlineBackup, listPublishProviders, publishProviderFor, resolvePublishFormat, resolvePublishRequest, runPublish, connectPublishProvider, disconnectPublishCredential, PublishSelectionsStore, readPublishSettings, setPublishProviderConfig };
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
PRESET_IDS,
|
|
23
23
|
PublishSelectionsStore,
|
|
24
24
|
RECOMMENDED_EXTENSIONS,
|
|
25
|
+
REPAIR_SNAPSHOT_MESSAGE,
|
|
25
26
|
RESERVED_PREFIX,
|
|
26
27
|
SEARCH_KEYWORDS,
|
|
27
28
|
SNIPPETS_DIR,
|
|
@@ -103,6 +104,7 @@ import {
|
|
|
103
104
|
refreshRemoteCopies,
|
|
104
105
|
removeExtension,
|
|
105
106
|
reorderExtensions,
|
|
107
|
+
repairOnlineBackup,
|
|
106
108
|
reportMissingTools,
|
|
107
109
|
requireGoogleClientCredentials,
|
|
108
110
|
resolveActiveStyles,
|
|
@@ -141,7 +143,7 @@ import {
|
|
|
141
143
|
syncProject,
|
|
142
144
|
testRemoteAccess,
|
|
143
145
|
validateProjectExtensions
|
|
144
|
-
} from "./index-
|
|
146
|
+
} from "./index-6dr6dn95.js";
|
|
145
147
|
import {
|
|
146
148
|
BUILD_DIAGNOSTIC_CODES
|
|
147
149
|
} from "./index-71pn94g1.js";
|
|
@@ -296,6 +298,7 @@ export {
|
|
|
296
298
|
reportMissingTools,
|
|
297
299
|
repoSubPath,
|
|
298
300
|
repoRootForSource,
|
|
301
|
+
repairOnlineBackup,
|
|
299
302
|
reorderExtensions,
|
|
300
303
|
removeExtension,
|
|
301
304
|
refreshRemoteCopies,
|
|
@@ -387,6 +390,7 @@ export {
|
|
|
387
390
|
SEARCH_KEYWORDS,
|
|
388
391
|
RESTORE_BACKUP_MESSAGE,
|
|
389
392
|
RESERVED_PREFIX,
|
|
393
|
+
REPAIR_SNAPSHOT_MESSAGE,
|
|
390
394
|
RECOMMENDED_EXTENSIONS,
|
|
391
395
|
PublishSelectionsStore,
|
|
392
396
|
PRESET_IDS,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SyncOutcome, SyncProjectOptions } from "./sync-types.ts";
|
|
2
|
+
/** Message recorded on the version a repair saves. */
|
|
3
|
+
export declare const REPAIR_SNAPSHOT_MESSAGE = "Repaired online backup";
|
|
4
|
+
export interface RepairOnlineBackupOptions extends Pick<SyncProjectOptions, "projectDir" | "credential" | "tokenStore" | "authorName" | "authorEmail" | "logFile" | "httpClient"> {
|
|
5
|
+
/**
|
|
6
|
+
* Where the old `.git` and the fresh download go — chosen by the host,
|
|
7
|
+
* OUTSIDE the book (a folder inside it would be committed). Created if
|
|
8
|
+
* missing; the old history is kept at `<backupDir>/git` indefinitely.
|
|
9
|
+
*/
|
|
10
|
+
backupDir: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RepairOnlineBackupResult {
|
|
13
|
+
/** The closing sync: "synced" / "up-to-date" when the repair worked. */
|
|
14
|
+
outcome: SyncOutcome;
|
|
15
|
+
/** Where the old `.git` was moved to. */
|
|
16
|
+
movedGitTo: string;
|
|
17
|
+
/** Files that existed online but not on this computer, restored from the download. */
|
|
18
|
+
restoredFiles: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function repairOnlineBackup(options: RepairOnlineBackupOptions): Promise<RepairOnlineBackupResult>;
|
|
@@ -16,10 +16,10 @@ export declare const MSG_BUSY = "The online copy is changing very quickly right
|
|
|
16
16
|
* The book's own version history is unreadable — a damaged or missing
|
|
17
17
|
* `.git`. Says the three things that are actually true and useful: the writing
|
|
18
18
|
* is safe, the HISTORY is what broke, and (sync always has a remote, so this
|
|
19
|
-
* always applies here)
|
|
19
|
+
* always applies here) Repair online backup is the way back.
|
|
20
20
|
*/
|
|
21
|
-
export declare const MSG_HISTORY_UNREADABLE = "This book's version history can't be read, so syncing can't continue. Your writing is safe \u2014 every file is still here on this computer.
|
|
22
|
-
export declare const MSG_UNRELATED = "This book and the online copy have no history in common, so they can't be combined. Either the online address points at a different book, or this book's own history was lost and started over. Your writing is safe \u2014 every file is still here on this computer. Check the online address; if it is correct,
|
|
21
|
+
export declare const MSG_HISTORY_UNREADABLE = "This book's version history can't be read, so syncing can't continue. Your writing is safe \u2014 every file is still here on this computer. Use Repair online backup (in Where your work is kept) to get history and syncing working again.";
|
|
22
|
+
export declare const MSG_UNRELATED = "This book and the online copy have no history in common, so they can't be combined. Either the online address points at a different book, or this book's own history was lost and started over. Your writing is safe \u2014 every file is still here on this computer. Check the online address; if it is correct, use Repair online backup (in Where your work is kept).";
|
|
23
23
|
export declare const MSG_NO_REMOTE = "This book isn't connected to an online repository yet.";
|
|
24
24
|
export declare const MSG_SSH_REMOTE = "This book's online address uses SSH (git@\u2026), which gutterpress can't sync to. Switch it to the web (HTTPS) address to sync from here.";
|
|
25
25
|
export declare const MSG_NO_BRANCH = "This book's version history isn't on a named branch, so it can't be synced right now.";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HostCredential } from "../token-store.ts";
|
|
2
|
+
import { type GitServer } from "./git-http-server.ts";
|
|
3
|
+
export declare const SERVER_AUTHOR: {
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
};
|
|
7
|
+
export interface Harness {
|
|
8
|
+
serverDir: string;
|
|
9
|
+
server: GitServer;
|
|
10
|
+
projectDir: string;
|
|
11
|
+
/** The credential the clone used, when the server required one. */
|
|
12
|
+
credential?: HostCredential;
|
|
13
|
+
cleanup(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function setupClone(opts?: {
|
|
16
|
+
requireAuth?: {
|
|
17
|
+
username: string;
|
|
18
|
+
password: string;
|
|
19
|
+
};
|
|
20
|
+
}): Promise<Harness>;
|
|
21
|
+
/** Commit `files` on the server (null deletes); returns the new tip. */
|
|
22
|
+
export declare function serverCommit(serverDir: string, files: Record<string, string | null>, message: string): Promise<string>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MANIFEST_FILENAMES,
|
|
3
3
|
runLint
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-64n9m3k8.js";
|
|
5
5
|
import {
|
|
6
6
|
log
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-vrnrsetc.js";
|
|
8
8
|
import {
|
|
9
9
|
UsageError,
|
|
10
10
|
rejectExtraPositionals,
|
|
11
11
|
rejectUnknownFlags
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-5fa9m71c.js";
|
|
13
13
|
import"./cli-h91e69hm.js";
|
|
14
14
|
import"./cli-c41yr7he.js";
|
|
15
15
|
import {
|
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
TARGET_IDS,
|
|
8
8
|
scaffoldExtension,
|
|
9
9
|
scaffoldProject
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-64n9m3k8.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveGhostscript
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-vrnrsetc.js";
|
|
14
14
|
import {
|
|
15
15
|
UsageError,
|
|
16
16
|
rejectExtraPositionals,
|
|
17
17
|
rejectUnknownFlags
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-5fa9m71c.js";
|
|
19
19
|
import"./cli-h91e69hm.js";
|
|
20
20
|
import {
|
|
21
21
|
isToolAvailable
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
executeValidation,
|
|
3
3
|
publishTargetFor,
|
|
4
4
|
reportMissingTools
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-64n9m3k8.js";
|
|
6
6
|
import {
|
|
7
7
|
log
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-vrnrsetc.js";
|
|
9
9
|
import {
|
|
10
10
|
UsageError,
|
|
11
11
|
rejectExtraPositionals,
|
|
12
12
|
rejectUnknownFlags
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-5fa9m71c.js";
|
|
14
14
|
import"./cli-h91e69hm.js";
|
|
15
15
|
import"./cli-c41yr7he.js";
|
|
16
16
|
import {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
runBuild,
|
|
7
7
|
splitOutPath,
|
|
8
8
|
startPreviewServer
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-64n9m3k8.js";
|
|
10
10
|
import {
|
|
11
11
|
log
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-vrnrsetc.js";
|
|
13
13
|
import {
|
|
14
14
|
UsageError,
|
|
15
15
|
parseFormat,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
rejectExtraPositionals,
|
|
18
18
|
rejectUnknownFlags,
|
|
19
19
|
resolvePort
|
|
20
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-5fa9m71c.js";
|
|
21
21
|
import"./cli-h91e69hm.js";
|
|
22
22
|
import"./cli-c41yr7he.js";
|
|
23
23
|
import {
|
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
publishProviderFor,
|
|
12
12
|
resolvePublishFormat,
|
|
13
13
|
runPublish
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-64n9m3k8.js";
|
|
15
15
|
import {
|
|
16
16
|
FileTokenStore,
|
|
17
17
|
log
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-vrnrsetc.js";
|
|
19
19
|
import {
|
|
20
20
|
UsageError,
|
|
21
21
|
rejectExtraPositionals,
|
|
22
22
|
rejectUnknownFlags
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-5fa9m71c.js";
|
|
24
24
|
import"./cli-h91e69hm.js";
|
|
25
25
|
import"./cli-c41yr7he.js";
|
|
26
26
|
import {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeAndReport
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-64n9m3k8.js";
|
|
4
4
|
import {
|
|
5
5
|
log
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-vrnrsetc.js";
|
|
7
7
|
import {
|
|
8
8
|
UsageError,
|
|
9
9
|
rejectExtraPositionals,
|
|
10
10
|
rejectUnknownFlags
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-5fa9m71c.js";
|
|
12
12
|
import"./cli-h91e69hm.js";
|
|
13
13
|
import"./cli-c41yr7he.js";
|
|
14
14
|
import {
|
package/package.json
CHANGED