turbo icon indicating copy to clipboard operation
turbo copied to clipboard

[turborepo] generator names in different workspaces conflict

Open Onurfesci opened this issue 1 year ago • 2 comments

What version of Turborepo are you using?

1.10.14

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Describe the Bug

Not sure if this is a bug, but it is unexpected behavior to me so I'd like to report it anyway.

When I have configs under different packages in the monorepo with the same generator name, only one of the packages shows up in the CLI output.

For example, I have a component generator under webapp-customer, and ui-kit. When I run turbo gen, I see this output:

onur@Onurs-MBP webapp-customer % turbo gen                  

>>> Modify "webapp-customer-react" using custom generators

? Select generator to run (Use arrow keys)
  ui-kit
❯   component: Create a new component 
    component-story: Generate component story 

If I change the generator name in config.ts in the webapp-customer package to something else, like webapp-component, and I run turbo gen:

onur@Onurs-MBP webapp-customer % turbo gen

>>> Modify "webapp-customer-react" using custom generators

? Select generator to run (Use arrow keys)
  webapp-customer
❯   webapp-component: Create a new component 
  ui-kit
    component: Create a new component 
    component-story: Generate component story 

Is this the expected behavior? Do generator names have to be unique across the monorepo?

Expected Behavior

I would expect all generators to show up as options, even if they have the same name within different packages in the monorepo. I feel like there may be unique component, or any type of generators, that have the same name but generate differently depending on the context of the package they are in.

To Reproduce

  • Add a turbo/generators/config.ts in separate packages in the monorepo
  • Add a plop.setGenerator('component') in both packages
  • Run turbo gen
  • Only one of the generators shows up as an option

Reproduction Repo

No response

Onurfesci avatar Oct 19 '23 10:10 Onurfesci