-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Schematic with multi select x-promt errors when using command line parameter: 'path ".foo" should be array' #16320
Comments
This is somewhat related to #12150 but in this case it's for Array's |
It seems that the cause of this error is somewhere in
InvalidInputOptions seems to be called with an object of {"name":"paul"} instead of: {"name":["paul"]}
|
hey @alan-agius4 do you think this issue will be faced before releasing Angular 10? I tried to understand the implementation and would like to contribute but I didn't find out how to debug it until now ^^ |
@alan-agius4 sorry, I meant Angular 9 in the above comment. |
@d-koppenhagen, currently this is not a top priority for the team. |
@alan-agius4 I see. Meanwhile I dounf out how to debug and install the CLI locally. I found the place where the error occurs. I provided a PR (#16985) to fix it. |
I don’t think that PR addresses the above issue. In the above issue you are using schematics CLI, however the fix is for Angular CLI. |
Yes that’s true. But with the fix and building the CLI locally, the described issue doesn’t appear. So I think it will fix it indeed. |
In the issue I just use the schematics CLI during the schematics development. But in the end I will run the schematic with the Angular CLI using |
For anyone interested, the current workaround works for me: schematics .:hello --debug=false --name=paul --name=peter (tested with Angular CLI: 11.2.12) |
Same problem(We're using Angular CLI v17.3.8) We're having the same problem in our open source library Spartacus, when our users run our installation schematics ( Workaround: first npm-install; then ng-addInterestingly, the error doesn't happen at all, if I first manually npm-install the pacakge and only then run the same Why the problem seems to happenThe problem of mis-interpreting the command-line option as a string instead of array seems to occur, because the anticipated As far as I could NodeJS-debug the whole process, AngularCLI command
Above workaround doesn't work when passing the exact version
|
Hi @alan-agius4 TBH I'd need a bit of an advice, how we could possibly workaround the limitations of the current architecture.
Do you have any idea of a workaround how we could re-parse the raw CLI arguments (i.e. invoke |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
No, it's not. Multi select prompt is just supported within angular cli >
9.0.0-rc.3
.Description
Creating an angular schematic that prompts the user for multiple options is possible since #16104. The prompt works quite good now but using the command line for multi selections will cause an error:
At first I opened an issue for the docs because I thought it's just not documented: angular/angular#33851 But after checking the implementation of the angular guard schematic which has
--implements
parameter (which works) and creating the minimal reproduction repo (see underneath), I think it's a bug somewhere in@angular-devkit/schematics-cli
.🔬 Minimal Reproduction
I created a very minimal repo for reproduction:
https://github.com/d-koppenhagen/ngx-multi-select-schematic
✅ Using prompt works good:
❌Using command line parameter fails (event not with just a single name handed over:
🔥 Exception or Error
🌍 Your Environment
The text was updated successfully, but these errors were encountered: