nestjs-architects / nx-ddd-plugin

Nx plugin for structuring a NestJS monorepo with DDD layers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Schematics incompatibility with recent nx versions

withoutlogin opened this issue · comments

Hi there,

I've noticed an issue while using this schematics tool. The problem is that generation of a domain library fails, probably during an update of workspace.json file.

Library versions:

  • @nestjs-architects/nx-ddd-plugin: 2.0.1
  • nx & @nrwl/* dependencies version: 14.3.1.

Repro steps:

  1. npx create-nx-workspace my-workspace --preset=nest (provide some app name, let's say my-app)
  2. cd my-workspace
  3. npm i -D @nestjs-architects/nx-ddd-plugin
  4. nx g @nestjs-architects/nx-ddd-plugin:add
  5. nx g @nestjs-architects/nx-ddd-plugin:domain my-domain

Expected behavior:

  • libs/my-domain directory is created and contains 3 library directories
  • workspace.json is updated
  • import mapping added to tsconfig.base.json, paths object
  • each generated library should have project.json file, allowing to add tags to enforce module boundaries by linter.

Actual behavior:

  • libs/my-domain directory is created with subdirectories that contain library boilerplates,
  • libraries don't have project.json file
  • workspace.json file is not updated
  • import mappings are not added to tsconfig.base.json,

Following stack trace appears:

>  NX  Generating @nestjs-architects/nx-ddd-plugin:domain

TypeError: Cannot convert undefined or null to object
    at NxScopedHost.writeWorkspaceConfiguration (my-workspace/node_modules/nx/src/adapter/ngcli-adapter.js:320:9)
    at my-workspace/node_modules/nx/src/adapter/ngcli-adapter.js:215:29
    at my-workspace/node_modules/rxjs/dist/cjs/internal/operators/switchMap.js:17:35
    at OperatorSubscriber._this._next (my-workspace/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:33:21)
    at OperatorSubscriber.Subscriber.next (my-workspace/node_modules/rxjs/dist/cjs/internal/Subscriber.js:51:18)
    at my-workspace/node_modules/rxjs/dist/cjs/internal/operators/switchMap.js:17:192
    at OperatorSubscriber._this._next (my-workspace/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:33:21)
    at OperatorSubscriber.Subscriber.next (my-workspace/node_modules/rxjs/dist/cjs/internal/Subscriber.js:51:18)
    at SafeSubscriber.__tryOrUnsub (my-workspace/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.next (my-workspace/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:143:22)