Runner: json-Typ vor eigener Erkennung (R21), Erstdeploy-Rueckfall, json-index beim Veroeffentlichen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-09-30 22:18:41 +00:00
1 parent 8a028ce75a
commit c256b78dae
5 files changed
+92 -14

No files matched your search

+21 -10
View File
@@ -294,6 +294,16 @@ export function createJobs({ config, docker, fs: fsOver = {}, git, mem = readMem
} catch { return workDir; }
}
// Erstes Deploy (noch kein <sub>-Ordner): Quellstand statisch veröffentlichen statt 403/leer (Verhalten des bisherigen Pfads).
async function firstDeployFallback(job, workDir, d, problem, onLine) {
if (job.mode === 'build') return false;
const target = join(config.previewsRoot, job.sub);
if (await fs.lstat(target).then(() => true, () => false)) return false;
onLine(`${problem} – erstes Deploy, Quellstand wird statisch veröffentlicht (Hinweis: Build fehlgeschlagen)`);
await publish(job, await webrootOf(workDir, job.index || d.index || ''), { skipGit: true, skipNodeModules: true, onLine });
return true;
}
// ---- Ablauf eines Build-Laufs ----
const execute = (run, job) => holdCache(job.repo, () => executeRun(run, job));
async function executeRun(run, job) {
@@ -307,10 +317,17 @@ export function createJobs({ config, docker, fs: fsOver = {}, git, mem = readMem
const d = prep.detected;
run.detected = d;
if (d.error) throw new Error(d.error);
if (prep.error) throw new Error(prep.error);
// Build-/Installationsproblem: erstes Deploy ⇒ Quellstand statisch (wie bisher), sonst Fehler (alte Preview bleibt)
const fallbackOr = async (problem) => {
if (!(await firstDeployFallback(job, workDir, d, problem, onLine))) throw new Error(problem);
run.result = 'static';
run.hint = 'Build fehlgeschlagen – Quellstand statisch veröffentlicht';
};
if (prep.error) { await fallbackOr(prep.error); final = 'done'; }
else
if (d.kind === 'static') {
if (d.hint) onLine(d.hint);
await publish(job, await webrootOf(workDir, job.index || ''), { skipGit: true, onLine });
await publish(job, await webrootOf(workDir, d.index || job.index || ''), { skipGit: true, onLine });
run.result = 'static';
} else if (d.kind === 'dev') {
run.result = 'dev';
@@ -325,14 +342,8 @@ export function createJobs({ config, docker, fs: fsOver = {}, git, mem = readMem
if (!out) problem = `Kein Ausgabeordner gefunden (gesucht: ${d.outputDirs.join(', ')})`;
}
if (problem) {
if (job.mode === 'auto' && d.devCmd) { onLine(`${problem} – Dev-Server wird verwendet`); run.result = 'dev'; }
else if (!out && !r.code && job.mode !== 'build') {
// Build lief, erzeugte aber keinen Ausgabeordner mit index.html: wie bisher den Quellstand statisch
// veröffentlichen (index-Unterordner, Kandidat/Platzhalter) statt die Subdomain zu verlieren.
onLine(`${problem} – Quellstand wird statisch veröffentlicht`);
await publish(job, await webrootOf(workDir, job.index || ''), { skipGit: true, skipNodeModules: true, onLine });
run.result = 'static';
} else throw new Error(problem);
if (job.mode === 'auto' && d.devCmd && !d.explicitType) { onLine(`${problem} – Dev-Server wird verwendet`); run.result = 'dev'; }
else await fallbackOr(problem);
} else {
await publish(job, out, { skipGit: false, onLine });
run.result = 'build';