Support Gitea configuration and safe Catalog Studio furniture completion
This commit is contained in:
1 parent
26f071117b
commit
9f791ba284
22 files changed
+1120
-166
No files matched your search
@@ -1,18 +1,22 @@
|
||||
import { promises as fs } from "node:fs";
|
||||
import { hostname } from "node:os";
|
||||
import path from "node:path";
|
||||
import {
|
||||
catalogGitEnvironment,
|
||||
readManagedCatalogConfig,
|
||||
} from "./catalog-git-config";
|
||||
import {
|
||||
CATALOG_BRANCH,
|
||||
CATALOG_REMOTE,
|
||||
publishCatalogFiles,
|
||||
recoverCatalogQueue,
|
||||
} from "./catalog-git-core";
|
||||
import { ensureManagedCatalogCheckout } from "./catalog-git-managed";
|
||||
import { catalogExportEnabled, catalogExportQueue } from "./catalog-git-queue";
|
||||
import { createCatalogSnapshot } from "./catalog-git-snapshot";
|
||||
|
||||
export async function runCatalogExport() {
|
||||
const checkout = process.env.CATALOG_GIT_CHECKOUT?.trim();
|
||||
if (!catalogExportEnabled() || !checkout) return;
|
||||
if (!catalogExportEnabled()) return;
|
||||
const queue = catalogExportQueue();
|
||||
await queue.entries();
|
||||
await recoverCatalogQueue(queue.root);
|
||||
@@ -51,10 +55,17 @@ export async function runCatalogExport() {
|
||||
// Any operation started/completed during capture invalidates the snapshot.
|
||||
const current = await queue.batch();
|
||||
if (!current || JSON.stringify(current) !== JSON.stringify(batch)) return;
|
||||
const config = readManagedCatalogConfig();
|
||||
if (config && !config.enabled) return;
|
||||
const checkout = config
|
||||
? await ensureManagedCatalogCheckout(config)
|
||||
: process.env.CATALOG_GIT_CHECKOUT?.trim();
|
||||
if (!checkout) return;
|
||||
const commit = await publishCatalogFiles({
|
||||
checkout,
|
||||
remote: CATALOG_REMOTE,
|
||||
branch: CATALOG_BRANCH,
|
||||
remote: config?.remote ?? CATALOG_REMOTE,
|
||||
branch: config?.branch ?? CATALOG_BRANCH,
|
||||
env: config ? catalogGitEnvironment(config) : undefined,
|
||||
files,
|
||||
});
|
||||
await queue.complete(batch);
|
||||
|
||||
Reference in new issue
Block a user