Skip to content

Commit

Permalink
fix: listr overriding parent task (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig authored Jul 26, 2024
1 parent 09cf7fd commit 88c31eb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 27 deletions.
6 changes: 2 additions & 4 deletions lib/update-v8/applyNodeChanges.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import path from 'node:path';

import { Listr } from 'listr2';

import {
getNodeV8Version,
filterForVersion,
Expand All @@ -19,10 +17,10 @@ const nodeChanges = [
export default function applyNodeChanges() {
return {
title: 'Apply Node-specific changes',
task: async(ctx) => {
task: async(ctx, task) => {
const v8Version = await getNodeV8Version(ctx.nodeDir);
const list = filterForVersion(nodeChanges, v8Version);
return new Listr(list.map((change) => change.task()));
return task.newListr(list.map((change) => change.task()));
}
};
}
Expand Down
13 changes: 6 additions & 7 deletions lib/update-v8/backport.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
} from 'node:fs';

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

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

return {
title: 'V8 commit backport',
task: () => {
return new Listr(todo);
task: (ctx, task) => {
return task.newListr(todo);
}
};
};
Expand Down Expand Up @@ -164,16 +163,16 @@ function applyPatches() {
function applyAndCommitPatches() {
return {
title: 'Apply and commit patches to deps/v8',
task: (ctx) => {
return new Listr(ctx.patches.map(applyPatchTask));
task: (ctx, task) => {
return task.newListr(ctx.patches.map(applyPatchTask));
}
};
}

function applyPatchTask(patch) {
return {
title: `Commit ${shortSha(patch.sha)}`,
task: (ctx) => {
task: (ctx, task) => {
const todo = [
{
title: 'Apply patch',
Expand All @@ -188,7 +187,7 @@ function applyPatchTask(patch) {
}
}
todo.push(commitPatch(patch));
return new Listr(todo);
return task.newListr(todo);
}
};
}
Expand Down
6 changes: 2 additions & 4 deletions lib/update-v8/majorUpdate.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import path from 'node:path';
import { promises as fs } from 'node:fs';

import { Listr } from 'listr2';

import { getCurrentV8Version } from './common.js';
import {
getNodeV8Version,
Expand All @@ -19,8 +17,8 @@ import { forceRunAsync } from '../run.js';
export default function majorUpdate() {
return {
title: 'Major V8 update',
task: () => {
return new Listr([
task: (ctx, task) => {
return task.newListr([
getCurrentV8Version(),
checkoutBranch(),
removeDepsV8(),
Expand Down
6 changes: 2 additions & 4 deletions lib/update-v8/minorUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import { spawn } from 'node:child_process';
import path from 'node:path';
import { promises as fs } from 'node:fs';

import { Listr } from 'listr2';

import { getCurrentV8Version } from './common.js';
import { isVersionString } from './util.js';
import { forceRunAsync } from '../run.js';

export default function minorUpdate() {
return {
title: 'Minor V8 update',
task: () => {
return new Listr([
task: (ctx, task) => {
return task.newListr([
getCurrentV8Version(),
getLatestV8Version(),
doMinorUpdate()
Expand Down
6 changes: 2 additions & 4 deletions lib/update-v8/updateV8Clone.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { promises as fs } from 'node:fs';

import { Listr } from 'listr2';

import { v8Git } from './constants.js';
import { forceRunAsync } from '../run.js';

export default function updateV8Clone() {
return {
title: 'Update local V8 clone',
task: () => {
return new Listr([fetchOrigin(), createClone()]);
task: (ctx, task) => {
return task.newListr([fetchOrigin(), createClone()]);
}
};
};
Expand Down
6 changes: 2 additions & 4 deletions lib/update-v8/updateVersionNumbers.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import path from 'node:path';
import { promises as fs } from 'node:fs';

import { Listr } from 'listr2';

import { getNodeV8Version } from './util.js';

export default function updateVersionNumbers() {
return {
title: 'Update version numbers',
task: () => {
return new Listr([resetEmbedderString(), bumpNodeModule()]);
task: (ctx, task) => {
return task.newListr([resetEmbedderString(), bumpNodeModule()]);
}
};
};
Expand Down

0 comments on commit 88c31eb

Please sign in to comment.