Skip to content

Commit e74a019

Browse files
Replace custom SearchListPrompt with @inquirer/search
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/f1344299-0cfc-4f05-a56e-7808031c327e Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
1 parent 91fd3a9 commit e74a019

9 files changed

Lines changed: 62 additions & 210 deletions

File tree

common/config/rush/nonbrowser-approved-packages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
"allowedCategories": [ "libraries" ]
3636
},
3737
{
38-
"name": "@inquirer/core",
38+
"name": "@inquirer/input",
3939
"allowedCategories": [ "libraries" ]
4040
},
4141
{
42-
"name": "@inquirer/input",
42+
"name": "@inquirer/search",
4343
"allowedCategories": [ "libraries" ]
4444
},
4545
{

common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

Lines changed: 18 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "65c94f09a60aafbc1a38b3011e59dcf9865f2da3",
3+
"pnpmShrinkwrapHash": "1ded19a2033fa7b23c21223431015a3179be3511",
44
"preferredVersionsHash": "550b4cee0bef4e97db6c6aad726df5149d20e7d9",
5-
"packageJsonInjectedDependenciesHash": "dddeee01c9be096aed723a6d7188660f343d33f8"
5+
"packageJsonInjectedDependenciesHash": "4926a8bfd5a32853df0e9a80bafa5ba5e038a008"
66
}

common/config/subspaces/default/pnpm-lock.yaml

Lines changed: 20 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "51461e1f21d68a3f1f7d48f8b93f79539bdc2024",
3+
"pnpmShrinkwrapHash": "2f5209600db25d0cff16de7f03cfd3679ca8348a",
44
"preferredVersionsHash": "029c99bd6e65c5e1f25e2848340509811ff9753c"
55
}

libraries/rush-lib/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@
6262
"dependency-path": "~9.2.8",
6363
"dotenv": "~16.4.7",
6464
"fast-glob": "~3.3.1",
65-
"figures": "3.0.0",
6665
"git-repo-info": "~2.1.0",
6766
"glob-escape": "~0.0.2",
6867
"https-proxy-agent": "~5.0.0",
6968
"ignore": "~5.1.6",
7069
"@inquirer/checkbox": "~5.1.3",
7170
"@inquirer/confirm": "~6.0.11",
72-
"@inquirer/core": "~11.1.8",
7371
"@inquirer/input": "~5.0.11",
72+
"@inquirer/search": "~4.1.7",
7473
"@inquirer/select": "~5.1.3",
7574
"js-yaml": "~4.1.0",
7675
"npm-package-arg": "~6.1.0",

libraries/rush-lib/src/logic/InteractiveUpgrader.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Colorize } from '@rushstack/terminal';
77
import type { RushConfiguration } from '../api/RushConfiguration';
88
import { upgradeInteractive, type IDepsToUpgradeAnswers } from '../utilities/InteractiveUpgradeUI';
99
import type { RushConfigurationProject } from '../api/RushConfigurationProject';
10-
import { searchListPrompt } from '../utilities/prompts/SearchListPrompt';
1110

1211
interface IUpgradeInteractiveDeps {
1312
projects: RushConfigurationProject[];
@@ -41,18 +40,26 @@ export class InteractiveUpgrader {
4140
private async _getUserSelectedProjectForUpgradeAsync(): Promise<RushConfigurationProject> {
4241
const projects: RushConfigurationProject[] | undefined = this._rushConfiguration.projects;
4342

44-
const selectProject: RushConfigurationProject = await searchListPrompt({
43+
const { default: search } = await import('@inquirer/search');
44+
45+
return await search<RushConfigurationProject>({
4546
message: 'Select a project you would like to upgrade',
46-
choices: projects.map((project) => {
47-
return {
48-
name: Colorize.green(project.packageName),
49-
value: project
50-
};
51-
}),
47+
source: (term) => {
48+
const choices: { name: string; short: string; value: RushConfigurationProject }[] = projects.map(
49+
(project) => ({
50+
name: Colorize.green(project.packageName),
51+
short: project.packageName,
52+
value: project
53+
})
54+
);
55+
if (!term) {
56+
return choices;
57+
}
58+
const filter: string = term.toUpperCase();
59+
return choices.filter((choice) => choice.short.toUpperCase().includes(filter));
60+
},
5261
pageSize: 12
5362
});
54-
55-
return selectProject;
5663
}
5764

5865
private async _getPackageDependenciesStatusAsync(

libraries/rush-lib/src/utilities/InteractiveUpgradeUI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Extended to use one type of text table
77

88
import CliTable from 'cli-table';
9-
import type { Separator } from '@inquirer/core';
9+
import type { Separator } from '@inquirer/checkbox';
1010

1111
import { AnsiEscape, Colorize } from '@rushstack/terminal';
1212
import type { INpmCheckPackageSummary } from '@rushstack/npm-check-fork';

0 commit comments

Comments
 (0)