Skip to content

Commit 88c31eb

Browse files
authored
fix: listr overriding parent task (#836)
1 parent 09cf7fd commit 88c31eb

File tree

6 files changed

+16
-27
lines changed

6 files changed

+16
-27
lines changed

lib/update-v8/applyNodeChanges.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import path from 'node:path';
22

3-
import { Listr } from 'listr2';
4-
53
import {
64
getNodeV8Version,
75
filterForVersion,
@@ -19,10 +17,10 @@ const nodeChanges = [
1917
export default function applyNodeChanges() {
2018
return {
2119
title: 'Apply Node-specific changes',
22-
task: async(ctx) => {
20+
task: async(ctx, task) => {
2321
const v8Version = await getNodeV8Version(ctx.nodeDir);
2422
const list = filterForVersion(nodeChanges, v8Version);
25-
return new Listr(list.map((change) => change.task()));
23+
return task.newListr(list.map((change) => change.task()));
2624
}
2725
};
2826
}

lib/update-v8/backport.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
} from 'node:fs';
55

66
import inquirer from 'inquirer';
7-
import { Listr } from 'listr2';
87
import { ListrEnquirerPromptAdapter } from '@listr2/prompt-adapter-enquirer';
98

109
import { shortSha } from '../utils.js';
@@ -50,8 +49,8 @@ export function doBackport(options) {
5049

5150
return {
5251
title: 'V8 commit backport',
53-
task: () => {
54-
return new Listr(todo);
52+
task: (ctx, task) => {
53+
return task.newListr(todo);
5554
}
5655
};
5756
};
@@ -164,16 +163,16 @@ function applyPatches() {
164163
function applyAndCommitPatches() {
165164
return {
166165
title: 'Apply and commit patches to deps/v8',
167-
task: (ctx) => {
168-
return new Listr(ctx.patches.map(applyPatchTask));
166+
task: (ctx, task) => {
167+
return task.newListr(ctx.patches.map(applyPatchTask));
169168
}
170169
};
171170
}
172171

173172
function applyPatchTask(patch) {
174173
return {
175174
title: `Commit ${shortSha(patch.sha)}`,
176-
task: (ctx) => {
175+
task: (ctx, task) => {
177176
const todo = [
178177
{
179178
title: 'Apply patch',
@@ -188,7 +187,7 @@ function applyPatchTask(patch) {
188187
}
189188
}
190189
todo.push(commitPatch(patch));
191-
return new Listr(todo);
190+
return task.newListr(todo);
192191
}
193192
};
194193
}

lib/update-v8/majorUpdate.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import path from 'node:path';
22
import { promises as fs } from 'node:fs';
33

4-
import { Listr } from 'listr2';
5-
64
import { getCurrentV8Version } from './common.js';
75
import {
86
getNodeV8Version,
@@ -19,8 +17,8 @@ import { forceRunAsync } from '../run.js';
1917
export default function majorUpdate() {
2018
return {
2119
title: 'Major V8 update',
22-
task: () => {
23-
return new Listr([
20+
task: (ctx, task) => {
21+
return task.newListr([
2422
getCurrentV8Version(),
2523
checkoutBranch(),
2624
removeDepsV8(),

lib/update-v8/minorUpdate.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ import { spawn } from 'node:child_process';
22
import path from 'node:path';
33
import { promises as fs } from 'node:fs';
44

5-
import { Listr } from 'listr2';
6-
75
import { getCurrentV8Version } from './common.js';
86
import { isVersionString } from './util.js';
97
import { forceRunAsync } from '../run.js';
108

119
export default function minorUpdate() {
1210
return {
1311
title: 'Minor V8 update',
14-
task: () => {
15-
return new Listr([
12+
task: (ctx, task) => {
13+
return task.newListr([
1614
getCurrentV8Version(),
1715
getLatestV8Version(),
1816
doMinorUpdate()

lib/update-v8/updateV8Clone.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { promises as fs } from 'node:fs';
22

3-
import { Listr } from 'listr2';
4-
53
import { v8Git } from './constants.js';
64
import { forceRunAsync } from '../run.js';
75

86
export default function updateV8Clone() {
97
return {
108
title: 'Update local V8 clone',
11-
task: () => {
12-
return new Listr([fetchOrigin(), createClone()]);
9+
task: (ctx, task) => {
10+
return task.newListr([fetchOrigin(), createClone()]);
1311
}
1412
};
1513
};

lib/update-v8/updateVersionNumbers.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import path from 'node:path';
22
import { promises as fs } from 'node:fs';
33

4-
import { Listr } from 'listr2';
5-
64
import { getNodeV8Version } from './util.js';
75

86
export default function updateVersionNumbers() {
97
return {
108
title: 'Update version numbers',
11-
task: () => {
12-
return new Listr([resetEmbedderString(), bumpNodeModule()]);
9+
task: (ctx, task) => {
10+
return task.newListr([resetEmbedderString(), bumpNodeModule()]);
1311
}
1412
};
1513
};

0 commit comments

Comments
 (0)