Skip to content

Files

Latest commit

3254412 · May 15, 2020

History

History

ddd

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 15, 2020
May 12, 2020
Apr 20, 2020
May 12, 2020
Mar 28, 2020
Apr 9, 2020
Mar 31, 2020
May 12, 2020
Apr 20, 2020
Mar 28, 2020
Mar 29, 2020
May 12, 2020

@xmlking/nxp-ddd

Nx plugin for structuring a monorepo with domains and layers following Domain Driven Development

DDD

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 adding feature modules

This library was generated with Nx.

Install

This npm package is available on GitHub Packages at nxp-ddd

Please add following to ~/.npmrc

@xmlking:registry=<https://npm.pkg.github.com/>
//npm.pkg.github.com/:_authToken=TOKEN
ng add @xmlking/nxp-ddd

Usage

# 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-ddd

# (Optional) In development, here is what I do to use without publishing to NPM:
yarn build:ddd # in nxp project
ng add ~/Developer/Work/SPA/nxp/dist/libs/ddd # in target project

# add web-app. optional flags: --platform <web/mobile/desktop/node>
ng g @xmlking/nxp-ddd:app yeti
# ng g @xmlking/nxp-ddd:app yeti --platform web

# generate domain. optional flags: --platform <web/mobile/desktop/node>  --app <appName> --lazy <true/false>
# defaults platform=web, app=defaultProject, lazy=true
nx g @xmlking/nxp-ddd:domain booking
nx g @xmlking/nxp-ddd:domain boarding  --platform web  --app yeti-web-app
# generate feature module. optional flags: --platform <web/mobile/desktop/node> --lazy  --entity <entity>
# defaults platform=web, app=defaultProject, lazy=true
nx g @xmlking/nxp-ddd:feature search --domain booking
nx g @xmlking/nxp-ddd:feature search --domain booking --entity flight
nx g @xmlking/nxp-ddd:feature search --domain booking --platform web --lazy
nx g @xmlking/nxp-ddd:feature search --domain booking --platform web --lazy=false
nx g @xmlking/nxp-ddd:feature manage --domain boarding --entity user

# generate entity.
nx g @xmlking/nxp-ddd:entity user --domain booking
nx g @xmlking/nxp-ddd:entity seat --domain boarding

Post-Setup Actions

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

Running unit tests

Run nx test ddd to execute the unit tests via Jest.