nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.29k stars 2.32k forks source link

Angular Monorepo with nx package not showing dependencies in graphs from commands dep-graph or affected:graph #11204

Closed nolegendhere closed 2 years ago

nolegendhere commented 2 years ago

NX 14.2.0 and next versions

We want to follow the angular layout only installing the nx package and adding the nx.json

Current Behavior

With an angular monorepo, running the command npx add-nx-to-monorepo adding only the package nx and the nx.json file, with the command dep-graph or affected:graph, the graph shown is flat, without dependencies

Expected Behavior

Like previous versions, for example 14.0.0 to 14.1.10, the graph should show the dependencies between libraries and apps

Steps to Reproduce

Generate a new angular workspace without an application like the angular libs tutorial indicates https://angular.io/guide/creating-libraries. Generate two applications, my-app01 and my-app02. Then, generate two libs, my-lib01 and my-lib02. Add my-lib01 ngModule to imports of my-app01 and my-lib02 to ngModule imports of my-app02. Run the command npx add-nx-to-monorepo, It will create and nx.json file and add the package nx to devDependencies in the package.json. Try with the different versions of nx package, from 14.0.0 to the latest the command dep-graph and affected:graph to see the results.

Environment

Ubuntu 20.04.4 LTS

nolegendhere commented 2 years ago

it is also happing with a project without angular, for example your https://github.com/FrozenPandaz/nx-minimal from https://www.youtube.com/watch?v=0WADb34Yjmg

AgentEnder commented 2 years ago

We currently disable js source file analysis in workspaces that use npx add-nx-to-monorepo, or others that consume nx/presets/npm.json in nx.json.

You can re-enable that by adding this to your nx.json:

"pluginsConfig": {
    "@nrwl/js": {
      "analyzeSourceFiles": true
    }
  }
github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.