Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: broken enquirer in listr2 #636

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/update-v8/applyNodeChanges.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'node:path';

import Enquirer from 'enquirer';
import { Listr } from 'listr2';

import {
Expand All @@ -22,7 +23,11 @@ export default function applyNodeChanges() {
task: async(ctx) => {
const v8Version = await getNodeV8Version(ctx.nodeDir);
const list = filterForVersion(nodeChanges, v8Version);
return new Listr(list.map((change) => change.task()));
return new Listr(list.map((change) => change.task()), {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
}
Expand Down
19 changes: 16 additions & 3 deletions lib/update-v8/backport.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
promises as fs
} from 'node:fs';

import Enquirer from 'enquirer';
import inquirer from 'inquirer';
import { Listr } from 'listr2';

Expand Down Expand Up @@ -50,7 +51,11 @@ export function doBackport(options) {
return {
title: 'V8 commit backport',
task: () => {
return new Listr(todo);
return new Listr(todo, {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
};
Expand Down Expand Up @@ -168,7 +173,11 @@ function applyAndCommitPatches() {
return {
title: 'Apply and commit patches to deps/v8',
task: (ctx) => {
return new Listr(ctx.patches.map(applyPatchTask));
return new Listr(ctx.patches.map(applyPatchTask), {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
}
Expand All @@ -191,7 +200,11 @@ function applyPatchTask(patch) {
}
}
todo.push(commitPatch(patch));
return new Listr(todo);
return new Listr(todo, {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
}
Expand Down
11 changes: 10 additions & 1 deletion lib/update-v8/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Enquirer from 'enquirer';
import { Listr } from 'listr2';

import { checkOptions, doBackport } from './backport.js';
Expand Down Expand Up @@ -33,8 +34,16 @@ export async function backport(options) {
return tasks.run(options);
};

/**
* Get the listr2 options.
* @param {{ verbose?: boolean }} options The original options.
* @return {import('listr2').ListrOptions} The listr2 options.
*/
function getOptions(opts) {
return {
renderer: opts.verbose ? 'verbose' : 'default'
renderer: opts.verbose ? 'verbose' : 'default',
injectWrapper: {
enquirer: new Enquirer()
}
};
}
7 changes: 6 additions & 1 deletion lib/update-v8/majorUpdate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'node:path';
import { promises as fs } from 'node:fs';

import Enquirer from 'enquirer';
import { execa } from 'execa';
import { Listr } from 'listr2';

Expand Down Expand Up @@ -28,7 +29,11 @@ export default function majorUpdate() {
addDepsV8(),
updateV8Deps(),
applyNodeChanges()
]);
], {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
};
Expand Down
7 changes: 6 additions & 1 deletion lib/update-v8/minorUpdate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'node:path';
import { promises as fs } from 'node:fs';

import Enquirer from 'enquirer';
import { execa } from 'execa';
import { Listr } from 'listr2';

Expand All @@ -14,7 +15,11 @@ export default function minorUpdate() {
getCurrentV8Version(),
getLatestV8Version(),
doMinorUpdate()
]);
], {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
};
Expand Down
7 changes: 6 additions & 1 deletion lib/update-v8/updateV8Clone.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { promises as fs } from 'node:fs';

import Enquirer from 'enquirer';
import { execa } from 'execa';
import { Listr } from 'listr2';

Expand All @@ -9,7 +10,11 @@ export default function updateV8Clone() {
return {
title: 'Update local V8 clone',
task: () => {
return new Listr([fetchOrigin(), createClone()]);
return new Listr([fetchOrigin(), createClone()], {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
};
Expand Down
7 changes: 6 additions & 1 deletion lib/update-v8/updateVersionNumbers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'node:path';
import { promises as fs } from 'node:fs';

import Enquirer from 'enquirer';
import { Listr } from 'listr2';

import { getNodeV8Version } from './util.js';
Expand All @@ -9,7 +10,11 @@ export default function updateVersionNumbers() {
return {
title: 'Update version numbers',
task: () => {
return new Listr([resetEmbedderString(), bumpNodeModule()]);
return new Listr([resetEmbedderString(), bumpNodeModule()], {
injectWrapper: {
enquirer: new Enquirer()
}
});
}
};
};
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"cheerio": "^1.0.0-rc.10",
"clipboardy": "^3.0.0",
"core-validate-commit": "^3.16.0",
"enquirer": "^2.3.6",
"execa": "^6.1.0",
"figures": "^4.0.1",
"form-data": "^4.0.0",
Expand Down