fix: preserve Listr build task nesting
This commit is contained in:
+27
-18
@@ -738,7 +738,7 @@ export async function runUp(
|
||||
};
|
||||
const workspacePath = `/workspaces/${encodeURIComponent(project)}`;
|
||||
|
||||
const taskCtx = await new Listr<UpContext, "default" | "simple">(
|
||||
const taskCtx = await new Listr<UpContext>(
|
||||
[
|
||||
{
|
||||
title: "Read compose",
|
||||
@@ -840,12 +840,16 @@ export async function runUp(
|
||||
);
|
||||
return operation;
|
||||
};
|
||||
await task
|
||||
.newListr<UpContext>(
|
||||
services.map((name) => ({
|
||||
return task.newListr<UpContext>(
|
||||
[
|
||||
...services.map((name) => ({
|
||||
title: `Build ${name}`,
|
||||
rendererOptions: { outputBar: 10, persistentOutput: true },
|
||||
task: async (_ctx, child) => {
|
||||
exitOnError: false,
|
||||
task: async (
|
||||
_ctx: UpContext,
|
||||
child: ListrTaskWrapper<UpContext, any, any>,
|
||||
) => {
|
||||
children.set(name, child);
|
||||
child.output = "Build queued";
|
||||
if (children.size === services.length) start();
|
||||
@@ -854,14 +858,20 @@ export async function runUp(
|
||||
child.output = "done";
|
||||
},
|
||||
})),
|
||||
{ concurrent: true, exitOnError: false },
|
||||
)
|
||||
.run();
|
||||
await operation;
|
||||
if (!result) throw operationFailure ?? new Error("Build images failed");
|
||||
taskCtx.buildImages = result.images;
|
||||
await config.postBuild?.(result, await getHookContext());
|
||||
task.title = `Built ${result.built.length} image${result.built.length === 1 ? "" : "s"}`;
|
||||
{
|
||||
task: async () => {
|
||||
await Promise.all(completed.values());
|
||||
await operation;
|
||||
if (!result)
|
||||
throw operationFailure ?? new Error("Build images failed");
|
||||
taskCtx.buildImages = result.images;
|
||||
await config.postBuild?.(result, await getHookContext());
|
||||
task.title = `Built ${result.built.length} image${result.built.length === 1 ? "" : "s"}`;
|
||||
},
|
||||
},
|
||||
],
|
||||
{ concurrent: true },
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -1072,11 +1082,10 @@ export async function runUp(
|
||||
},
|
||||
],
|
||||
{
|
||||
// Build progress can remain queued across many polls. The default TTY
|
||||
// spinner redraws every child on every tick, which duplicates those
|
||||
// frames in captured terminal output. Simple emits only task events.
|
||||
renderer: build ? "simple" : "default",
|
||||
rendererOptions: { collapseErrors: false },
|
||||
renderer: "default",
|
||||
// Only redraw when a task changes; a queued build should not generate
|
||||
// another frame on each spinner tick. Keep the renderer's task tree.
|
||||
rendererOptions: { collapseErrors: false, collapseSubtasks: false, lazy: true },
|
||||
},
|
||||
).run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user