@conloca/content-api 0.1.6 → 0.1.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/node.d.mts.map +1 -1
- package/dist/node.mjs +193 -211
- package/dist/node.mjs.map +1 -1
- package/package.json +1 -2
package/dist/node.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.mts","names":[],"sources":["../src/asset-manifest.ts","../src/asset-operations.ts","../src/cf-access.ts","../src/component-registry.ts","../src/filesystem-content-api.ts","../src/content-watcher.ts","../src/in-memory-content-api.ts","../src/middleware.ts","../src/vite-plugin.ts"],"sourcesContent":[],"mappings":";;;;;;cAiBa,aAAA;;;UAOG,QAAQ;EAPX,KAAA,CAAA,IAAA,EAgBO,iBAhBM,CAAA,EAgBc,OAhBd,CAAA,IAAA,CAAA;EAOF,GAAA,CAAA,YAAA,EAAA,MAAA,EAAA,IAAA,EAagB,iBAbhB,CAAA,EAaoC,OAbpC,CAAA,IAAA,CAAA;EAAR,MAAA,CAAA,YAAA,EAAA,MAAA,CAAA,EAmBsB,OAnBtB,CAAA,OAAA,CAAA;EASI,GAAA,CAAA,YAAA,EAAA,MAAA,CAAA,EAkBe,OAlBf,CAkBuB,iBAlBvB,GAAA,SAAA,CAAA;EAAoB;;;;EAkBG,aAAA,CAAA,QAAA,EAAA,MAAA,CAAA,EASF,OATE,CAAA;IAAR,YAAA,EAAA,MAAA;IAS4C,IAAA,EAAA,iBAAA;EAAtC,CAAA,GAAA,SAAA,CAAA;;;;UC7CxB,WAAA;;;;;EDEJ,WAAA,CAAA,EAAA,MAAa;;AAOV,cC8BH,eAAA,CD9BG;EASI,QAAA,MAAA;EAAoB,QAAA,QAAA;EAIA,QAAA,UAAA;EAAoB,QAAA,QAAA;EAMtB,WAAA,CAAA,MAAA,ECiBhB,WDjBgB;EAQK,QAAA,SAAA;EAAR;;;;;;;ACpCnC;AAuCA;;EAmJU,QAAA,eAAA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0B,eLjgB1B,CAAA;EAuCf,uBAAe,CAAA,YAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EK8d+B,WL9d/B,CAAA,EK8d6C,SL9d7C,CK8duD,eL9dvD,CAAA;EAMN,eAAA,CAAA,KAAA,EK6dS,iBL7dT,CAAA,EK6d6B,OL7d7B,CK6dqC,YL7drC,CAAA;EA6IZ,WAAA,CAAA,UAAA,EKoYsB,iBLpYtB,EAAA,CAAA,EKoY4C,OLpY5C,CKoYoD,WLpYpD,CAAA;EAE2B,UAAA,CAAA,EAAA,EAAA,MAAA,EAAA,OAAA,EKqaH,YLraG,CAAA,EAAA,IAAA;EAAhC,KAAA,CAAA,CAAA,EAAA,IAAA;EAkFmB,kBAAA,CAAA,EAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EKyYnB,OLzYmB,CAAA;IAAR,MAAA,EK0YJ,UL1YI;IAyC0C,IAAA,EAAA,MAAA;IAAR,WAAA,EAAA,kBAAA,GAAA,UAAA;EAoDF,CAAA,GAAA,IAAA,CAAA;;;;;;;ADzWhD;AAOwB,UOUP,uBAAA,CPVO;EAAR,UAAA,CAAA,EAAA,MAAA;EASI,WAAA,CAAA,EOGJ,IPHI,COGC,WPHD,EAAA,YAAA,CAAA;EAAoB;EAIA,WAAA,CAAA,EAAA,MAAA;;AAMF,iBOFtB,sBAAA,CPEsB,GAAA,EOFM,UPEN,EAAA,OAAA,CAAA,EOF4B,uBPE5B,CAAA,EOFmD,IPEnD,COFmD,WAAA,CAAA,QAAA,EAAA,WAAA,CAAA,WAAA,EPEnD,GAAA,CAAA;;;;;AAiBU,
|
|
1
|
+
{"version":3,"file":"node.d.mts","names":[],"sources":["../src/asset-manifest.ts","../src/asset-operations.ts","../src/cf-access.ts","../src/component-registry.ts","../src/filesystem-content-api.ts","../src/content-watcher.ts","../src/in-memory-content-api.ts","../src/middleware.ts","../src/vite-plugin.ts"],"sourcesContent":[],"mappings":";;;;;;cAiBa,aAAA;;;UAOG,QAA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AA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EKyYnB,OLzYmB,CAAA;IAAR,MAAA,EK0YJ,UL1YI;IAyC0C,IAAA,EAAA,MAAA;IAAR,WAAA,EAAA,kBAAA,GAAA,UAAA;EAoDF,CAAA,GAAA,IAAA,CAAA;;;;;;;ADzWhD;AAOwB,UOUP,uBAAA,CPVO;EAAR,UAAA,CAAA,EAAA,MAAA;EASI,WAAA,CAAA,EOGJ,IPHI,COGC,WPHD,EAAA,YAAA,CAAA;EAAoB;EAIA,WAAA,CAAA,EAAA,MAAA;;AAMF,iBOFtB,sBAAA,CPEsB,GAAA,EOFM,UPEN,EAAA,OAAA,CAAA,EOF4B,uBPE5B,CAAA,EOFmD,IPEnD,COFmD,WAAA,CAAA,QAAA,EAAA,WAAA,CAAA,WAAA,EPEnD,GAAA,CAAA;;;;;AAiBU,iBOqlChC,uBAAA,CPrlCgC,UAAA,EOqlCI,UPrlCJ,CAAA,EAAA,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,IAAA,EAAA,GAAA,GAAA,IAAA,EAAA,GOylCI,OPzlCJ,CAAA,IAAA,CAAA;;;UQtD/B,qBAAA;;;;;ARWjB;;;;AAgBwC,iBQjBxB,cAAA,CRiBwB,OAAA,EQjBA,qBRiBA,CAAA,EQjBwB,MRiBxB"}
|
package/dist/node.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { C as normalizePathname, D as Blocks, E as serializeMdxWithFrontmatter, S as mapSiteNames, T as resolvePublishDate, _ as isMetadataTooLarge, a as buildLocaleVersion, b as localesOf, c as updatePublishDates, d as extractBlockName, f as formatFileSize, g as isContentPublished, h as getMetadataSize, i as analyzeUpdateScope, l as validateAndPrepareMetadata, m as getCurrentISODate, n as Site, o as buildPathnameHistory, p as generateContentId, r as UPDATE_SCOPE, s as shouldUpdateModifiedTimestamp, t as ErrorCodes, u as validateCreateContent, v as isValidBlockName, w as parseDate, x as mapLocales, y as isValidPathname } from "./types-C-DD0VsU.mjs";
|
|
2
2
|
import sortKeys from "sort-keys";
|
|
3
3
|
import { access, mkdir, open, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
4
|
-
import { dirname, extname, join, parse,
|
|
4
|
+
import { dirname, extname, join, parse, resolve } from "node:path";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { imageSize } from "image-size";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
|
-
import { Octokit } from "@octokit/rest";
|
|
9
8
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
10
9
|
import { mkdir as mkdir$1, readFile as readFile$1, rename as rename$1, unlink as unlink$1, writeFile as writeFile$1 } from "fs/promises";
|
|
11
10
|
import { dirname as dirname$1, join as join$1, normalize, resolve as resolve$1 } from "path";
|
|
@@ -64,33 +63,101 @@ var AssetManifest = class {
|
|
|
64
63
|
|
|
65
64
|
//#endregion
|
|
66
65
|
//#region src/git-operations.ts
|
|
66
|
+
function runGitCommand(cwd, args) {
|
|
67
|
+
return new Promise((resolveCommand, reject) => {
|
|
68
|
+
const process$1 = spawn("git", args, {
|
|
69
|
+
cwd,
|
|
70
|
+
stdio: [
|
|
71
|
+
"ignore",
|
|
72
|
+
"pipe",
|
|
73
|
+
"pipe"
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
let stdout = "";
|
|
77
|
+
let stderr = "";
|
|
78
|
+
process$1.stdout.on("data", (data) => {
|
|
79
|
+
stdout += data.toString();
|
|
80
|
+
});
|
|
81
|
+
process$1.stderr.on("data", (data) => {
|
|
82
|
+
stderr += data.toString();
|
|
83
|
+
});
|
|
84
|
+
process$1.on("error", reject);
|
|
85
|
+
process$1.on("close", (exitCode) => {
|
|
86
|
+
resolveCommand({
|
|
87
|
+
exitCode: exitCode ?? 1,
|
|
88
|
+
stdout: stdout.trim(),
|
|
89
|
+
stderr: stderr.trim()
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve the git repository root from a content path.
|
|
96
|
+
* Uses `git rev-parse --show-toplevel` starting from the parent of the content directory.
|
|
97
|
+
*/
|
|
98
|
+
async function resolveRepoRoot(contentPath) {
|
|
99
|
+
const result = await runGitCommand(dirname(resolve(contentPath)), ["rev-parse", "--show-toplevel"]);
|
|
100
|
+
if (result.exitCode !== 0) return null;
|
|
101
|
+
return result.stdout;
|
|
102
|
+
}
|
|
67
103
|
/**
|
|
68
|
-
* Create git operations using
|
|
69
|
-
*
|
|
104
|
+
* Create git operations using local git CLI commands.
|
|
105
|
+
* Requires git binary available on PATH and CONTENT_PATH inside a git repository.
|
|
70
106
|
*/
|
|
71
107
|
function createGitOperations(config) {
|
|
72
|
-
const {
|
|
73
|
-
const branch = config.branch || "main";
|
|
74
|
-
const [owner, repoName] = repo.split("/");
|
|
75
|
-
const octokit = new Octokit({ auth: token });
|
|
108
|
+
const { contentPath, branch } = config;
|
|
76
109
|
return {
|
|
77
110
|
async getStatus() {
|
|
78
111
|
try {
|
|
79
|
-
await
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
return {
|
|
85
|
-
isRepo: true,
|
|
86
|
-
hasChanges: true,
|
|
112
|
+
const repoRoot = await resolveRepoRoot(contentPath);
|
|
113
|
+
if (!repoRoot) return {
|
|
114
|
+
isRepo: false,
|
|
115
|
+
hasChanges: false,
|
|
87
116
|
changedFiles: 0,
|
|
88
117
|
ahead: 0,
|
|
89
118
|
behind: 0,
|
|
90
|
-
branch
|
|
119
|
+
branch: "unknown"
|
|
91
120
|
};
|
|
92
|
-
|
|
93
|
-
|
|
121
|
+
const branchResult = await runGitCommand(repoRoot, [
|
|
122
|
+
"rev-parse",
|
|
123
|
+
"--abbrev-ref",
|
|
124
|
+
"HEAD"
|
|
125
|
+
]);
|
|
126
|
+
const currentBranch = branchResult.exitCode === 0 ? branchResult.stdout : "unknown";
|
|
127
|
+
const statusResult = await runGitCommand(repoRoot, ["status", "--porcelain"]);
|
|
128
|
+
const changedFiles = (statusResult.stdout ? statusResult.stdout.split("\n").filter((l) => l.trim()) : []).length;
|
|
129
|
+
const hasChanges = changedFiles > 0;
|
|
130
|
+
const remoteConfigured = (await runGitCommand(repoRoot, [
|
|
131
|
+
"remote",
|
|
132
|
+
"get-url",
|
|
133
|
+
"origin"
|
|
134
|
+
])).exitCode === 0;
|
|
135
|
+
let ahead = 0;
|
|
136
|
+
let behind = 0;
|
|
137
|
+
if (remoteConfigured) {
|
|
138
|
+
const revListResult = await runGitCommand(repoRoot, [
|
|
139
|
+
"rev-list",
|
|
140
|
+
"--left-right",
|
|
141
|
+
"--count",
|
|
142
|
+
`HEAD...origin/${branch || currentBranch}`
|
|
143
|
+
]);
|
|
144
|
+
if (revListResult.exitCode === 0 && revListResult.stdout) {
|
|
145
|
+
const [a, b] = revListResult.stdout.split(" ").map(Number);
|
|
146
|
+
ahead = a || 0;
|
|
147
|
+
behind = b || 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
isRepo: true,
|
|
152
|
+
hasChanges,
|
|
153
|
+
changedFiles,
|
|
154
|
+
ahead,
|
|
155
|
+
behind,
|
|
156
|
+
branch: currentBranch,
|
|
157
|
+
remoteConfigured
|
|
158
|
+
};
|
|
159
|
+
} catch {
|
|
160
|
+
return {
|
|
94
161
|
isRepo: false,
|
|
95
162
|
hasChanges: false,
|
|
96
163
|
changedFiles: 0,
|
|
@@ -98,100 +165,129 @@ function createGitOperations(config) {
|
|
|
98
165
|
behind: 0,
|
|
99
166
|
branch: "unknown"
|
|
100
167
|
};
|
|
101
|
-
throw error;
|
|
102
168
|
}
|
|
103
169
|
},
|
|
104
170
|
async commitAll(message, author) {
|
|
105
171
|
try {
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
172
|
+
const repoRoot = await resolveRepoRoot(contentPath);
|
|
173
|
+
if (!repoRoot) return {
|
|
108
174
|
success: false,
|
|
109
|
-
error: "
|
|
175
|
+
error: "Not a git repository"
|
|
176
|
+
};
|
|
177
|
+
const addResult = await runGitCommand(repoRoot, ["add", "-A"]);
|
|
178
|
+
if (addResult.exitCode !== 0) return {
|
|
179
|
+
success: false,
|
|
180
|
+
error: addResult.stderr || "Failed to stage changes"
|
|
181
|
+
};
|
|
182
|
+
if ((await runGitCommand(repoRoot, [
|
|
183
|
+
"diff",
|
|
184
|
+
"--cached",
|
|
185
|
+
"--quiet"
|
|
186
|
+
])).exitCode === 0) return {
|
|
187
|
+
success: false,
|
|
188
|
+
error: "No changes to commit"
|
|
189
|
+
};
|
|
190
|
+
const diffStatResult = await runGitCommand(repoRoot, [
|
|
191
|
+
"diff",
|
|
192
|
+
"--cached",
|
|
193
|
+
"--numstat"
|
|
194
|
+
]);
|
|
195
|
+
const fileCount = diffStatResult.stdout ? diffStatResult.stdout.split("\n").filter((l) => l.trim()).length : 0;
|
|
196
|
+
const commitArgs = [
|
|
197
|
+
"commit",
|
|
198
|
+
"-m",
|
|
199
|
+
message
|
|
200
|
+
];
|
|
201
|
+
if (author) commitArgs.push("--author", `${author.name} <${author.email}>`);
|
|
202
|
+
const commitResult = await runGitCommand(repoRoot, commitArgs);
|
|
203
|
+
if (commitResult.exitCode !== 0) return {
|
|
204
|
+
success: false,
|
|
205
|
+
error: commitResult.stderr || "Commit failed"
|
|
110
206
|
};
|
|
111
|
-
const { data: refData } = await octokit.git.getRef({
|
|
112
|
-
owner,
|
|
113
|
-
repo: repoName,
|
|
114
|
-
ref: `heads/${branch}`
|
|
115
|
-
});
|
|
116
|
-
const parentSha = refData.object.sha;
|
|
117
|
-
const { data: commitData } = await octokit.git.getCommit({
|
|
118
|
-
owner,
|
|
119
|
-
repo: repoName,
|
|
120
|
-
commit_sha: parentSha
|
|
121
|
-
});
|
|
122
|
-
const baseTreeSha = commitData.tree.sha;
|
|
123
|
-
const blobs = await Promise.all(files.map((file) => octokit.git.createBlob({
|
|
124
|
-
owner,
|
|
125
|
-
repo: repoName,
|
|
126
|
-
content: file.encoding === "base64" ? file.content : Buffer.from(file.content).toString("base64"),
|
|
127
|
-
encoding: "base64"
|
|
128
|
-
})));
|
|
129
|
-
const { data: treeData } = await octokit.git.createTree({
|
|
130
|
-
owner,
|
|
131
|
-
repo: repoName,
|
|
132
|
-
base_tree: baseTreeSha,
|
|
133
|
-
tree: files.map((file, i) => ({
|
|
134
|
-
path: file.path,
|
|
135
|
-
mode: "100644",
|
|
136
|
-
type: "blob",
|
|
137
|
-
sha: blobs[i].data.sha
|
|
138
|
-
}))
|
|
139
|
-
});
|
|
140
|
-
const { data: newCommit } = await octokit.git.createCommit({
|
|
141
|
-
owner,
|
|
142
|
-
repo: repoName,
|
|
143
|
-
message,
|
|
144
|
-
tree: treeData.sha,
|
|
145
|
-
parents: [parentSha],
|
|
146
|
-
...author && { author }
|
|
147
|
-
});
|
|
148
|
-
await octokit.git.updateRef({
|
|
149
|
-
owner,
|
|
150
|
-
repo: repoName,
|
|
151
|
-
ref: `heads/${branch}`,
|
|
152
|
-
sha: newCommit.sha
|
|
153
|
-
});
|
|
154
207
|
return {
|
|
155
208
|
success: true,
|
|
156
|
-
commit:
|
|
157
|
-
summary: `${
|
|
209
|
+
commit: (await runGitCommand(repoRoot, ["rev-parse", "HEAD"])).stdout || void 0,
|
|
210
|
+
summary: `${fileCount} files committed`
|
|
158
211
|
};
|
|
159
212
|
} catch (error) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
213
|
+
return {
|
|
214
|
+
success: false,
|
|
215
|
+
error: error instanceof Error ? error.message : "Commit failed"
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
async pushOrigin() {
|
|
220
|
+
try {
|
|
221
|
+
const repoRoot = await resolveRepoRoot(contentPath);
|
|
222
|
+
if (!repoRoot) return {
|
|
223
|
+
success: false,
|
|
224
|
+
error: "Not a git repository"
|
|
225
|
+
};
|
|
226
|
+
if ((await runGitCommand(repoRoot, [
|
|
227
|
+
"remote",
|
|
228
|
+
"get-url",
|
|
229
|
+
"origin"
|
|
230
|
+
])).exitCode !== 0) return {
|
|
231
|
+
success: false,
|
|
232
|
+
error: "No git remote \"origin\" configured. Please configure a remote to enable push."
|
|
233
|
+
};
|
|
234
|
+
let targetBranch = branch;
|
|
235
|
+
if (!targetBranch) targetBranch = (await runGitCommand(repoRoot, [
|
|
236
|
+
"rev-parse",
|
|
237
|
+
"--abbrev-ref",
|
|
238
|
+
"HEAD"
|
|
239
|
+
])).stdout;
|
|
240
|
+
const pushResult = await runGitCommand(repoRoot, [
|
|
241
|
+
"push",
|
|
242
|
+
"origin",
|
|
243
|
+
targetBranch
|
|
244
|
+
]);
|
|
245
|
+
if (pushResult.exitCode !== 0) {
|
|
246
|
+
const stderr = pushResult.stderr || "";
|
|
247
|
+
if (stderr.includes("non-fast-forward") || stderr.includes("rejected")) return {
|
|
164
248
|
success: false,
|
|
165
|
-
error: "
|
|
249
|
+
error: "Push rejected: remote has changes. Pull first, then try pushing again."
|
|
166
250
|
};
|
|
167
|
-
if (
|
|
251
|
+
if (stderr.includes("Could not resolve host")) return {
|
|
252
|
+
success: false,
|
|
253
|
+
error: "Cannot reach git remote. Check your network connection."
|
|
254
|
+
};
|
|
255
|
+
if (stderr.includes("Permission denied") || stderr.includes("Authentication failed")) return {
|
|
256
|
+
success: false,
|
|
257
|
+
error: "Git remote authentication failed. Check server SSH key or credential configuration."
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
168
260
|
success: false,
|
|
169
|
-
error: "
|
|
261
|
+
error: stderr || "Push failed"
|
|
170
262
|
};
|
|
171
263
|
}
|
|
264
|
+
return { success: true };
|
|
265
|
+
} catch (error) {
|
|
172
266
|
return {
|
|
173
267
|
success: false,
|
|
174
|
-
error: error instanceof Error ? error.message : "
|
|
268
|
+
error: error instanceof Error ? error.message : "Push failed"
|
|
175
269
|
};
|
|
176
270
|
}
|
|
177
271
|
},
|
|
178
|
-
async pushOrigin() {
|
|
179
|
-
return { success: true };
|
|
180
|
-
},
|
|
181
272
|
async pull() {
|
|
182
273
|
try {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
if (repositoryCheck.exitCode !== 0) return {
|
|
274
|
+
const repoRoot = await resolveRepoRoot(contentPath);
|
|
275
|
+
if (!repoRoot) return {
|
|
186
276
|
success: false,
|
|
187
|
-
error:
|
|
277
|
+
error: "Not a git repository"
|
|
188
278
|
};
|
|
189
|
-
|
|
279
|
+
let targetBranch = branch;
|
|
280
|
+
if (!targetBranch) targetBranch = (await runGitCommand(repoRoot, [
|
|
281
|
+
"rev-parse",
|
|
282
|
+
"--abbrev-ref",
|
|
283
|
+
"HEAD"
|
|
284
|
+
])).stdout;
|
|
285
|
+
const pullResult = await runGitCommand(repoRoot, [
|
|
190
286
|
"pull",
|
|
191
287
|
"--autostash",
|
|
192
288
|
"--rebase",
|
|
193
289
|
"origin",
|
|
194
|
-
|
|
290
|
+
targetBranch
|
|
195
291
|
]);
|
|
196
292
|
if (pullResult.exitCode !== 0) return {
|
|
197
293
|
success: false,
|
|
@@ -199,7 +295,7 @@ function createGitOperations(config) {
|
|
|
199
295
|
};
|
|
200
296
|
return {
|
|
201
297
|
success: true,
|
|
202
|
-
summary: pullResult.stdout || `Pulled latest changes from origin/${
|
|
298
|
+
summary: pullResult.stdout || `Pulled latest changes from origin/${targetBranch}`
|
|
203
299
|
};
|
|
204
300
|
} catch (error) {
|
|
205
301
|
return {
|
|
@@ -210,102 +306,6 @@ function createGitOperations(config) {
|
|
|
210
306
|
}
|
|
211
307
|
};
|
|
212
308
|
}
|
|
213
|
-
function runGitCommand(cwd, args) {
|
|
214
|
-
return new Promise((resolveCommand, reject) => {
|
|
215
|
-
const process$1 = spawn("git", args, {
|
|
216
|
-
cwd,
|
|
217
|
-
stdio: [
|
|
218
|
-
"ignore",
|
|
219
|
-
"pipe",
|
|
220
|
-
"pipe"
|
|
221
|
-
]
|
|
222
|
-
});
|
|
223
|
-
let stdout = "";
|
|
224
|
-
let stderr = "";
|
|
225
|
-
process$1.stdout.on("data", (data) => {
|
|
226
|
-
stdout += data.toString();
|
|
227
|
-
});
|
|
228
|
-
process$1.stderr.on("data", (data) => {
|
|
229
|
-
stderr += data.toString();
|
|
230
|
-
});
|
|
231
|
-
process$1.on("error", reject);
|
|
232
|
-
process$1.on("close", (exitCode) => {
|
|
233
|
-
resolveCommand({
|
|
234
|
-
exitCode: exitCode ?? 1,
|
|
235
|
-
stdout: stdout.trim(),
|
|
236
|
-
stderr: stderr.trim()
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
const BINARY_ASSET_EXTENSIONS = new Set([
|
|
242
|
-
".jpg",
|
|
243
|
-
".jpeg",
|
|
244
|
-
".png",
|
|
245
|
-
".gif",
|
|
246
|
-
".svg",
|
|
247
|
-
".webp",
|
|
248
|
-
".avif",
|
|
249
|
-
".ico"
|
|
250
|
-
]);
|
|
251
|
-
/**
|
|
252
|
-
* Recursively collect all content files (.vxjson, .mdx, and .json in data/) and optionally binary asset files.
|
|
253
|
-
*/
|
|
254
|
-
async function collectContentFiles(dirPath, basePath, assetsPath, inDataDir = false) {
|
|
255
|
-
const base = basePath ?? dirPath;
|
|
256
|
-
const files = [];
|
|
257
|
-
try {
|
|
258
|
-
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
259
|
-
for (const entry of entries) {
|
|
260
|
-
const fullPath = join(dirPath, entry.name);
|
|
261
|
-
if (entry.isDirectory()) {
|
|
262
|
-
const isDataDir = dirPath === base && entry.name === "data";
|
|
263
|
-
const subFiles = await collectContentFiles(fullPath, base, void 0, inDataDir || isDataDir);
|
|
264
|
-
files.push(...subFiles);
|
|
265
|
-
} else if (entry.isFile()) {
|
|
266
|
-
if (entry.name.endsWith(".vxjson") || entry.name.endsWith(".mdx") || inDataDir && entry.name.endsWith(".json")) {
|
|
267
|
-
const content = await readFile(fullPath, "utf-8");
|
|
268
|
-
const relativePath = relative(join(base, ".."), fullPath);
|
|
269
|
-
files.push({
|
|
270
|
-
path: relativePath,
|
|
271
|
-
content,
|
|
272
|
-
encoding: "utf-8"
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
} catch {}
|
|
278
|
-
if (assetsPath && !basePath) {
|
|
279
|
-
const assetFiles = await collectAssetFiles(assetsPath, dirPath);
|
|
280
|
-
files.push(...assetFiles);
|
|
281
|
-
}
|
|
282
|
-
return files;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Recursively collect binary asset files, returning them as base64-encoded blobs.
|
|
286
|
-
*/
|
|
287
|
-
async function collectAssetFiles(assetsDir, contentDir) {
|
|
288
|
-
const files = [];
|
|
289
|
-
try {
|
|
290
|
-
const entries = await readdir(assetsDir, { withFileTypes: true });
|
|
291
|
-
for (const entry of entries) {
|
|
292
|
-
const fullPath = join(assetsDir, entry.name);
|
|
293
|
-
if (entry.isDirectory()) {
|
|
294
|
-
const subFiles = await collectAssetFiles(fullPath, contentDir);
|
|
295
|
-
files.push(...subFiles);
|
|
296
|
-
} else if (entry.isFile() && BINARY_ASSET_EXTENSIONS.has(extname(entry.name).toLowerCase())) {
|
|
297
|
-
const buffer = await readFile(fullPath);
|
|
298
|
-
const relativePath = relative(join(contentDir, ".."), fullPath);
|
|
299
|
-
files.push({
|
|
300
|
-
path: relativePath,
|
|
301
|
-
content: buffer.toString("base64"),
|
|
302
|
-
encoding: "base64"
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
} catch {}
|
|
307
|
-
return files;
|
|
308
|
-
}
|
|
309
309
|
const LFS_PATTERNS = [
|
|
310
310
|
"*.jpg filter=lfs diff=lfs merge=lfs -text",
|
|
311
311
|
"*.jpeg filter=lfs diff=lfs merge=lfs -text",
|
|
@@ -4995,34 +4995,16 @@ function createContentAPIRouter(api, options) {
|
|
|
4995
4995
|
}
|
|
4996
4996
|
});
|
|
4997
4997
|
/**
|
|
4998
|
-
* Get
|
|
4999
|
-
* Required: GITHUB_TOKEN, GITHUB_REPO
|
|
5000
|
-
* Optional: GITHUB_BRANCH (defaults to 'main'), CONTENT_PATH (defaults to 'content/')
|
|
5001
|
-
*/
|
|
5002
|
-
function getGitConfig() {
|
|
5003
|
-
const token = process.env.GITHUB_TOKEN;
|
|
5004
|
-
const repo = process.env.GITHUB_REPO;
|
|
5005
|
-
if (!token || !repo) throw new Error("GITHUB_TOKEN and GITHUB_REPO environment variables required");
|
|
5006
|
-
return {
|
|
5007
|
-
token,
|
|
5008
|
-
repo,
|
|
5009
|
-
branch: process.env.GITHUB_BRANCH || "main",
|
|
5010
|
-
contentPath: process.env.CONTENT_PATH || "content/"
|
|
5011
|
-
};
|
|
5012
|
-
}
|
|
5013
|
-
/**
|
|
5014
|
-
* Get local-git pull config for VPS workflows.
|
|
4998
|
+
* Get git config from environment variables.
|
|
5015
4999
|
* Required: CONTENT_PATH
|
|
5016
|
-
* Optional:
|
|
5000
|
+
* Optional: GIT_BRANCH (defaults to current checked-out branch)
|
|
5017
5001
|
*/
|
|
5018
|
-
function
|
|
5002
|
+
function getGitConfig() {
|
|
5019
5003
|
const contentPath = process.env.CONTENT_PATH;
|
|
5020
|
-
if (!contentPath) throw new Error("CONTENT_PATH environment variable required for
|
|
5004
|
+
if (!contentPath) throw new Error("CONTENT_PATH environment variable is required for git operations");
|
|
5021
5005
|
return {
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
branch: process.env.GITHUB_BRANCH || "main",
|
|
5025
|
-
contentPath
|
|
5006
|
+
contentPath,
|
|
5007
|
+
branch: process.env.GIT_BRANCH
|
|
5026
5008
|
};
|
|
5027
5009
|
}
|
|
5028
5010
|
app.get("/git/status", async (c) => {
|
|
@@ -5031,7 +5013,7 @@ function createContentAPIRouter(api, options) {
|
|
|
5031
5013
|
if (!status.isRepo) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, "Repository not accessible"), 400);
|
|
5032
5014
|
return c.json(status);
|
|
5033
5015
|
} catch (error) {
|
|
5034
|
-
if (error instanceof Error && error.message.includes("
|
|
5016
|
+
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5035
5017
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_STATUS_FAILED, "Failed to get git status"), 500);
|
|
5036
5018
|
}
|
|
5037
5019
|
});
|
|
@@ -5063,7 +5045,7 @@ function createContentAPIRouter(api, options) {
|
|
|
5063
5045
|
if (!result.success) return c.json(errorResponse(ErrorCodes.GIT_COMMIT_FAILED, result.error || "Commit failed"), 500);
|
|
5064
5046
|
return c.json(result);
|
|
5065
5047
|
} catch (error) {
|
|
5066
|
-
if (error instanceof Error && error.message.includes("
|
|
5048
|
+
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5067
5049
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_COMMIT_FAILED, "Failed to commit changes"), 500);
|
|
5068
5050
|
}
|
|
5069
5051
|
});
|
|
@@ -5073,17 +5055,17 @@ function createContentAPIRouter(api, options) {
|
|
|
5073
5055
|
if (!result.success) return c.json(errorResponse(ErrorCodes.GIT_PUSH_FAILED, result.error || "Push failed"), 500);
|
|
5074
5056
|
return c.json(result);
|
|
5075
5057
|
} catch (error) {
|
|
5076
|
-
if (error instanceof Error && error.message.includes("
|
|
5058
|
+
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5077
5059
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_PUSH_FAILED, "Failed to push to origin"), 500);
|
|
5078
5060
|
}
|
|
5079
5061
|
});
|
|
5080
5062
|
app.post("/git/pull", async (c) => {
|
|
5081
5063
|
try {
|
|
5082
|
-
const result = await createGitOperations(
|
|
5064
|
+
const result = await createGitOperations(getGitConfig()).pull();
|
|
5083
5065
|
if (!result.success) return c.json(errorResponse(ErrorCodes.GIT_PULL_FAILED, result.error || "Pull failed"), 500);
|
|
5084
5066
|
return c.json(result);
|
|
5085
5067
|
} catch (error) {
|
|
5086
|
-
if (error instanceof Error && error.message.includes("
|
|
5068
|
+
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5087
5069
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_PULL_FAILED, "Failed to pull from origin"), 500);
|
|
5088
5070
|
}
|
|
5089
5071
|
});
|