angular-architects / nx-ddd-plugin

Nx plugin for structuring a monorepo with domains and layers
313 stars 56 forks source link

Ambiguous modules/modules with same names #13

Closed draylegend closed 3 years ago

draylegend commented 4 years ago

By generating domains I get this folder structure:

libs:
  company:
    domain:
      src:
        lib:
          domain.module.ts
        index.ts
        ...
  expert:
    domain:
      src:
        lib:
          domain.module.ts
        index.ts
        ...

Then I wanna import company and expert "modules". There're at least two ways to import:

There is no problem with the lazy approach but with non lazy:

import { DomainModule as ExpertModule } from '@workspace/expert/domain';
import { DomainModule as CompanyModule } from '@workspace/company/domain';

@NgModule({
  imports: [
    ExpertModule,
    CompanyModule,
  ]
})
...

In the sample above I need to use aliases as ExpertModule and as CompanyModule to be able to import both modules with the identical class name. We, devs, are pretty lazy and that approach compels us to add an extra alias for every lib/module name.

What about class names that match the names passed in while generating a lib?

manfredsteyer commented 4 years ago

How did you create the domains?

If I use

ng g @angular-architects/ddd:domain admin --directory web

I get a CompanyDomainModule.

manfredsteyer commented 3 years ago

Closing this, as it seems like the discussion came to an end. Feel free to reopen on demand