Skip to content

Migrate rush-lib from deprecated inquirer to @inquirer/* modular packages#5775

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/replace-deprecated-inquirer-package
Draft

Migrate rush-lib from deprecated inquirer to @inquirer/* modular packages#5775
Copilot wants to merge 4 commits intomainfrom
copilot/replace-deprecated-inquirer-package

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Replaces the deprecated monolithic inquirer package with the new @inquirer/* scoped packages, using only the specific prompt-type packages actually consumed. All packages use await import() (dynamic import) rather than static imports because every @inquirer/* package ships ESM-only ("type": "module"), which would break the CJS Jest environment if statically required.

Package changes (libraries/rush-lib)

  • Added: @inquirer/search, @inquirer/select, @inquirer/input, @inquirer/confirm, @inquirer/checkbox
  • Removed: inquirer, @types/inquirer, figures
  • nonbrowser-approved-packages.json updated accordingly

SearchListPrompt.ts — deleted

The custom searchable list prompt is replaced entirely by the off-the-shelf @inquirer/search prompt, which provides equivalent functionality. SearchListPrompt.ts is removed.

InteractiveUpgrader.ts

Replaced new Prompt({ list: SearchListPrompt }).run([…]) with a direct await search({…}) call from @inquirer/search. A synchronous source function filters the static project list by plain package name; the name field remains ANSI-colored for display while short holds the plain name used for filtering and the answer summary.

const { default: search } = await import('@inquirer/search');
return await search<RushConfigurationProject>({
  message: 'Select a project you would like to upgrade',
  source: (term) => {
    const choices = projects.map((project) => ({
      name: Colorize.green(project.packageName),
      short: project.packageName,
      value: project
    }));
    if (!term) return choices;
    const filter = term.toUpperCase();
    return choices.filter((choice) => choice.short.toUpperCase().includes(filter));
  },
  pageSize: 12
});

ChangeAction.ts

Replaced inquirer.createPromptModule() and the promptModule parameter threading through all private methods with inline dynamic imports at each call site. All promptModule: InquirerType.PromptModule parameters removed.

// Before
const { appendComment } = await promptModule({ type: 'list', name: 'appendComment',});

// After
const { default: select } = await import('@inquirer/select');
const appendComment = await select<'skip' | 'append'>({ message: , choices:  });

InteractiveUpgradeUI.ts

Replaced inquirer.prompt([{ type: 'checkbox', … }]) with @inquirer/checkbox and new inquirer.Separator() with @inquirer/checkbox's re-exported Separator. The @inquirer/checkbox module is dynamically imported at the top of upgradeInteractive(); unselectable and createChoices helpers are defined as closures inside it to close over the runtime Separator class.

Copilot AI and others added 3 commits April 15, 2026 23:55
…ynamic imports

Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/489f4c8b-19ff-4dd2-9198-b68f948590c4

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/489f4c8b-19ff-4dd2-9198-b68f948590c4

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
import type { Interface } from 'node:readline';

// Modified from the choice list prompt in inquirer:
// https://github.com/SBoudrias/Inquirer.js/blob/inquirer%407.3.3/packages/inquirer/lib/prompts/list.js
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot I had thought this prompt might do something special, but it sounds like the new @inquirer/search prompt is probably equivalent? In which case, go ahead and use that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e74a019. SearchListPrompt.ts is deleted entirely — InteractiveUpgrader now calls @inquirer/search directly, passing a synchronous source function that filters the static project list by plain package name. @inquirer/core and figures are removed as direct dependencies.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

2 participants