angular-architects / nx-ddd-plugin

Nx plugin for structuring a monorepo with domains and layers
321 stars 56 forks source link

issue in domain generator when creating an associated application #134

Open FabienDehopre opened 1 year ago

FabienDehopre commented 1 year ago

In the latest nx workspace, when you try to create a domain with an associated application (--addApp=true), the generator fail with the following error message: "Cannot read properties of undefined (reading 'replace')". In fact, the issue comes from the fact that the generator tries to get the workspace npm scope from the nx.json file (using the readWorkspaceConfiguration function). Unfortunately, the npmScope property on the nx.json file is now deprecated (see official doc: https://nx.dev/packages/devkit/documents/Workspace#npmscope) and is not added to the nx.json file in new workspace. To get the workspace npm scope, you need to use the getNpmScope function instead.

L-X-T commented 1 year ago

Thank you for the report @FabienDehopre, I've encountered a similar problem which is also due to the reading of the npmScope. I'll inform @manfredsteyer.

scsete commented 1 month ago

@L-X-T :I have the same issue with or without project addition during execution. I'm using pnpm.


Angular: 18.2.0 Nx: 20.0.2 @angular-architects/ddd:19.0.1

`➜ frontends git:(feature/ITU-5-FE-Poc) ✗ nx g @angular-architects/ddd:domain --name=dashboard --directory=lib --verbose

NX Generating @angular-architects/ddd:domain

✔ Would you like to add an associated application? (y/N) · true

NX Cannot read properties of undefined (reading 'replace')

TypeError: Cannot read properties of undefined (reading 'replace') at removeWindowsDriveLetter (/Users/xxx/nodemodules/.pnpm/nx@20.0.2@swc-node+register@1.9.2@swc+core@1.5.29@swc+helpers@0.5.13__@swc+types@0.1.12_ty_7tbae4hpjjuxpyy2rwgajkg5ge/node_modules/nx/src/utils/path.js:9:27) at normalizePath (/Users/xxx/nodemodules/.pnpm/nx@20.0.2@swc-node+register@1.9.2@swc+core@1.5.29@swc+helpers@0.5.13@swc+types@0.1.12_ty_7tbae4hpjjuxpyy2rwgajkg5ge/node_modules/nx/src/utils/path.js:16:12) at determineProjectNameAndRootOptions (/Users/xxx/node_modules/.pnpm/@nx+devkit@20.0.2nx@20.0.2@swc-node+register@1.9.2@swc+core@1.5.29@swc+helpers@0.5.13@s_nhdvhkpuyueyd5oub2ncp4g37i/node_modules/@nx/devkit/src/generators/project-name-and-root-utils.js:10:58) at normalizeOptions (/Users/xxx/node_modules/.pnpm/@nx+angular@20.0.2_txy3i4udpobywqxqkkhoq7ybaq/node_modules/@nx/angular/src/generators/library/lib/normalize-options.js:26:151) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async libraryGenerator (/Users/xxx/node_modules/.pnpm/@nx+angular@20.0.2_txy3i4udpobywqxqkkhoq7ybaq/node_modules/@nx/angular/src/generators/library/library.js:38:21) `


There was no activity in this thread. Any advice how to proceed?

L-X-T commented 1 month ago

@scsete no, I'm very sorry: currently no advice. I'll ask @manfredsteyer once more. I know he's been rather busy recently.