raw app improvements

This commit is contained in:
Ruben Fiszel
2026-01-20 08:37:11 +00:00
parent c143e78d7f
commit bb22fcb3a4
6 changed files with 47 additions and 5 deletions

View File

@@ -932,6 +932,29 @@ function ZipFSElement(
};
}
// Helper to simplify fields for YAML output
// { type: 'static', value: X } -> { value: X }
// { type: 'ctx', ctx: X } -> { ctx: X }
function simplifyFields(fields: Record<string, any> | undefined) {
if (!fields) return undefined;
const simplified: Record<string, any> = {};
for (const [k, v] of Object.entries(fields)) {
if (typeof v === "object" && v !== null) {
if (v.type === "static" && v.value !== undefined) {
simplified[k] = { value: v.value };
} else if (v.type === "ctx" && v.ctx !== undefined) {
simplified[k] = { ctx: v.ctx };
} else {
// Keep other field types as-is
simplified[k] = v;
}
} else {
simplified[k] = v;
}
}
return simplified;
}
// Yield each runnable as a separate YAML file in the backend folder
// For inline scripts, simplify the YAML - inlineScript is not needed since
// content/lock/language can be derived from sibling files
@@ -969,6 +992,11 @@ function ZipFSElement(
simplifiedRunnable = runnableObj;
}
// Simplify fields for cleaner YAML output
if (simplifiedRunnable.fields) {
simplifiedRunnable.fields = simplifyFields(simplifiedRunnable.fields);
}
yield {
isDirectory: false,
path: path.join(