-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Command
generate, add
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
18.0.7
Description
Since switch to @inquirer/prompts library, x-prompt no longer supports providing default options for properties with type list
that support multiselect. It's related to changes in the API comparing to previous inquirer
package. Now, the default value can be set by checked
flag which is part of each object in choices
array: https://github.com/SBoudrias/Inquirer.js/tree/main/packages/checkbox#choice-object
PR: #28842
I'm happy to contribute and I'd appreciate a guidance to not miss any place that could be affected and should be adjusted.
Minimal Reproduction
To reproduce the issue, clone the following repository and go to its location:
git clone https://github.com/pawelfras/x-prompt-list-issue.git
Run npm install
to install dependencies and build the project by running ng build
.
To test with latest version of @angular/cli
, run:
npx @angular-devkit/schematics-cli@latest .:x-prompt-list-issue
Hit enter without any custom selection and see the expected output:
? Choose numbers (1 and 3 should be selected by default)
Selected numbers: []
Nothing to be done.
To test with version v18.0.7, run:
npx @angular-devkit/[email protected] .:x-prompt-list-issue
Hit enter without any custom selection and see the expected output:
? Choose numbers (1 and 3 should be selected by default) 1, 3
Selected numbers: [ 1, 3 ]
Exception or Error
Your Environment
Angular CLI: 18.2.11
Node: 20.18.0
Package Manager: yarn 1.22.22
OS: darwin arm64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1802.11 (cli-only)
@angular-devkit/core 18.2.11
@angular-devkit/schematics 18.2.11
@schematics/angular 18.2.11 (cli-only)
typescript 5.5.4
Anything else relevant?
The issue has been spotted also in the latest Angular 19 RC version