nx: Breaking changes in `nx print-affected` when moving from 14.1.9 to 14.2.2

Current Behavior

We use nx print-affected and pipe it to a JSON file. We then use that to implement linting around our local package dependencies.

In 14.2.2 a the affected json file might look like:

{
  "tasks": [],
  "projects": [],
  "projectGraph": {
    "nodes": [
      "myApp",
      "myLib",
    ],
    "dependencies": {
      "myApp": [
        {
          "source": "myApp",
          "target": "npm:axios",
          "type": "static"
        },
      ]
   // …
}       

Expected Behavior

{
  "tasks": [],
  "projects": [],
  "projectGraph": {
    "nodes": [
      "myApp",
      "myLib",
    ],
    "dependencies": {
      "myApp": [
        {
          "source": "myApp",
          "target": "myLib", // THIS IS MISSING IN 14.2.2
          "type": "static"
        },
        {
          "source": "myApp",
          "target": "npm:axios",
          "type": "static"
        },
      ]
   // …
}       

Notice the key difference – that a local dependency on myLib is no longer exposed in the print-affected project graph.

Steps to Reproduce

  1. make a project using nx <= 14.1.9
  2. make the project have at least 1 application target that depends on at least 1 local library target
  3. examine the output of nx print-affected
  4. notice that the dependency on the local library targets are documented via a "target" line that does not include npm:
  5. upgrade to nx 14.2.2 & compare the output of nx print-affected
  6. Notice that the local dependencies are no longer described in the projectGraph::dependencies node

Failure Logs

No failure logs present – just undocumented breaking changes

Environment

>  NX   Report complete - copy this into the issue template

   Node : 16.12.0
   OS   : darwin x64
   yarn : 1.22.17
   
   nx : 14.2.2
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.2.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.2.2
   @nrwl/eslint-plugin-nx : 14.2.2
   @nrwl/express : 14.2.2
   @nrwl/jest : 14.2.2
   @nrwl/js : 14.2.2
   @nrwl/linter : 14.2.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 14.2.2
   @nrwl/nx-cloud : 14.0.8
   @nrwl/nx-plugin : 14.2.2
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : 14.2.2
   @nrwl/workspace : 14.2.2
   typescript : 4.7.3
   ---------------------------------------
   Community plugins:

✨  Done in 0.72s.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

nx migrate latest --from 14.1.9 would recreate a migrations json with those