nx-console icon indicating copy to clipboard operation
nx-console copied to clipboard

Generator labels do not show up

Open shadow1349 opened this issue 1 year ago • 4 comments

Current Behavior

I was trying to create a custom generator with a dropdown and I noticed that only values appear. I tried this:

    "type": {
      "type": "string",
      "description": "Provide the library type",
      "x-prompt": {
        "message": "Which type of library would you like to generate?",
        "type": "list",
        "items": [
          {
            "value": "da",
            "label": "Data Access"
          },
          {
            "value": "f",
            "label": "Feature"
          },
          {
            "value": "s",
            "label": "State Management"
          }
        ]
      }
    }

and got this:

Screenshot 2024-02-23 at 11 05 48 AM

This is even apparent for other things like the Angular application generator.

https://github.com/nrwl/nx/blob/master/packages/angular/src/generators/application/schema.json#L29

Screenshot 2024-02-23 at 11 02 27 AM

Expected Behavior

I want the labels to appear instead of the values

GitHub Repo

No response

Steps to Reproduce

  1. Create an nx plugin with a generator
  2. Add a type in the generator with an xprompt that has a list
  3. View the generator

Nx Report

Node   : 18.18.2
   OS     : darwin-arm64
   npm    : 9.8.1
   
   nx                 : 18.0.2
   @nx/js             : 18.0.4
   @nx/jest           : 18.0.4
   @nx/linter         : 18.0.3
   @nx/eslint         : 18.0.3
   @nx/workspace      : 18.0.2
   @nx/angular        : 18.0.4
   @nx/cypress        : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/eslint-plugin  : 18.0.3
   @nx/playwright     : 18.0.4
   @nx/plugin         : 18.0.4
   @nrwl/tao          : 18.0.2
   @nx/web            : 18.0.4
   @nx/webpack        : 18.0.4
   typescript         : 5.3.3
   ---------------------------------------
   Community plugins:
   ngx-build-plus : 17.0.0

Failure Logs

No response

Package Manager Version

npm - 9.8.1

Operating System

  • [X] macOS
  • [ ] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

No response

shadow1349 avatar Feb 23 '24 17:02 shadow1349

I think this works properly on the CLI. Going to transfer to nx console repo to investigate the UI issue.

AgentEnder avatar Mar 04 '24 19:03 AgentEnder

Hey! Yeah this is a known issue currently :) The thing is, it would complicate things in the code quite a bit because ultimately you'll still have to pass the values to the CLI.

We're going to get around to fixing it eventually but not 100% sure when. If you're interested in helping out with a contribution to get it updated more quickly, I'd love to help too.

MaxKless avatar Mar 05 '24 08:03 MaxKless

Thanks for the reply! If I have some time, I will definitely take a look.

shadow1349 avatar Mar 07 '24 20:03 shadow1349

we're probably going to tackle it quite soon, actually. Lmk if you end up taking a look so we don't duplicate work.

MaxKless avatar Mar 08 '24 09:03 MaxKless