angular-architects / nx-ddd-plugin

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

add domain library with secondary entrypoints #99

Open wizardnet972 opened 2 years ago

wizardnet972 commented 2 years ago

Nx release secondary entrypoints sometime ago. By adding secondary entrypoints, we basically split our Angular libraries into multiple chunks, just like Angular Material does.

@manfredsteyer What do you think about using nx library-secondary-entry-point generator? the main library is the "domain" and the secondary entrypoints will be the "features", "ui", "utils", "api".

The structure be:

 libs
   + booking
       + feature-search
          + src
             + lib
                  ***.module.ts
              - index.ts
            - README.md
            - package.json  
       + feature-cancel
            .... same as feature search ....
       + ui-search
           .... same ....
       + src <--- this is the files and folders for the main library.
          + lib
               + applications
               + entities
               + infrastructure
               - index.ts
         - .eslintrc.json
         - README.md
         - ng-package.json
          ......

and the imports:

import { facade } from '@org/booking;
import { .... } from '@org/booking/feature-search';
...

example of creating library-secondary-entry-point:

npx nx generate @nrwl/angular:library-secondary-entry-point 
 --name=feature-search
 --library=booking

What do you think?