nrwl / nx-console

Nx Console is the user interface for Nx & Lerna.
https://nx.dev
MIT License
1.31k stars 210 forks source link

Generator labels do not show up #2044

Open shadow1349 opened 6 months ago

shadow1349 commented 6 months ago

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

Additional Information

No response

AgentEnder commented 6 months ago

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

MaxKless commented 6 months ago

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.

shadow1349 commented 6 months ago

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

MaxKless commented 6 months ago

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