vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.18k stars 1.81k forks source link

[turborepo] generator names in different workspaces conflict #6215

Open Onurfesci opened 12 months ago

Onurfesci commented 12 months ago

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

Reproduction Repo

No response

mehulkar commented 12 months ago

This seems like a bug, I would also expect that generator names do not have to be unique across an entire monorepo. Thanks for the report!

mayank1513 commented 5 months ago

Also, it takes significant time for turbo to show up the option to select the generator. Why is it so? Even if turbo is searching for generator in all the files in the project (except the node_modules and build files), it shouldn't take so much time.