Nx plugin for refactoring default nx monorepo into Domain, Shell, Data-Access and Feature modules.
Also makes Apps tiny by moving assets, styles, and environments into shared libraries.
This plugin adds some enhancements to @manfredsteyer DDD Nx plugin
- State Management with ngxs
- Shell Library patterns
- Ability to add
entities
independently as well as along with addingfeature
modules
This library was generated with Nx.
This npm package is available on GitHub Packages at nxp-begetter
Please add following to ~/.npmrc
@xmlking:registry=<https://npm.pkg.github.com/>
//npm.pkg.github.com/:_authToken=TOKEN
ng add @xmlking/nxp-begetter
# scaffold workspace
ng new yeti -c=@nrwl/workspace --preset=empty --style=scss --npm-scope=yeti --app-name=yeti -v
cd yeti
# update deps
ng update --all --allow-dirty --force
# add nx plugins (schematics)
ng add @nrwl/angular --defaults
ng add @xmlking/nxp-begetter
# (Optional) In development, here is what I do to use without publishing to NPM:
yarn build:begetter # in nxp project
ng add ~/Developer/Work/SPA/nxp/dist/libs/begetter # in target project
# add web-app. optional flags: --platform <web/mobile/desktop/nest>
ng g @xmlking/nxp-begetter:app yeti
# ng g @xmlking/nxp-begetter:app yeti --platform web
# generate domain. optional flags: --platform <web/mobile/desktop/nest> --app <appName> --lazy <true/false>
# defaults platform=web, app=defaultProject, lazy=true
nx g @xmlking/nxp-begetter:domain booking
nx g @xmlking/nxp-begetter:domain boarding --platform web --app yeti-web-app
# generate feature module. optional flags: --platform <web/mobile/desktop/nestjs> --lazy --entity <entity>
# defaults platform=web, app=defaultProject, lazy=true
nx g @xmlking/nxp-begetter:feature search --domain booking
nx g @xmlking/nxp-begetter:feature search --domain booking --entity flight
nx g @xmlking/nxp-begetter:feature search --domain booking --platform web --lazy
nx g @xmlking/nxp-begetter:feature search --domain booking --platform web --lazy=false
nx g @xmlking/nxp-begetter:feature manage --domain boarding --entity user
# generate entity.
nx g @xmlking/nxp-begetter:entity user --domain booking
nx g @xmlking/nxp-begetter:entity seat --domain boarding
After generation all modules, you might have to remove pathMatch: 'full'
and adjust your routes in some module's Router config .
Optionally add <router-outlet></router-outlet>
in shell component's HTML
Run nx test begetter
to execute the unit tests via Jest.