angular-architects / nx-ddd-plugin

Nx plugin for structuring a monorepo with domains and layers
308 stars 55 forks source link

bug: when create feature with directory flag the files got wrong due to missing using with prefix #106

Open wizardnet972 opened 2 years ago

wizardnet972 commented 2 years ago

When I run commands to create features in different directories (with the same name) the command is successfully executed:

yarn nx g @angular-architects/ddd:feature --app ddd-ui --lazy --directory foo --name view --domain booking
yarn nx g @angular-architects/ddd:feature --app ddd-ui --lazy --directory bar --name view --domain booking

But inside the domain lib, only one view.facade.ts was created. and in the index.ts is exporting files that do not exist: https://github.com/wizardnet972/nx-ddd/blob/main/libs/booking/domain/src/index.ts#L3

export * from './lib/booking-domain.module';
export * from './lib/application/foo-view.facade';
export * from './lib/application/bar-view.facade';
image

ALSO the component gets prefix but no need for prefix.

image

Suggested Solution: add directory prefix to facade files including module names.

When I create a feature with directory flag, the files:

Reproduce:

git clone https://github.com/wizardnet972/nx-ddd.git
yarn
check the domain file.

OR

 npx create-nx-workspace
✔ Workspace name (e.g., org name)     · nx-ddd
✔ What to create in the new workspace · angular
✔ Application name                    · ddd-ui
✔ Default stylesheet format           · scss

yarn add @angular-architects/ddd
yarn nx g @angular-architects/ddd:domain booking
yarn nx g @angular-architects/ddd:feature --app ddd-ui --lazy --directory foo --name view --domain booking
yarn nx g @angular-architects/ddd:feature --app ddd-ui --lazy --directory bar --name view --domain booking