nrwl / nx

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

`nx print-affected --select projects` return all projects when deleting a project #20691

Closed orlevii closed 4 months ago

orlevii commented 9 months ago

Current Behavior

When running nx print-affected --select projects (or nx show projects --affected) the output returns all the projects in the repository when deleting a project.

I tried to ask as a discussions, but no replies. https://github.com/nrwl/nx/discussions/20548

(Tested on Linux and MacOS)

Expected Behavior

No project should be returned.

GitHub Repo

https://github.com/orlevii/nx-examples

Steps to Reproduce

I forked the nx-examples repository and deleted a project from the apps directory.

  1. Clone & install dependencies (https://github.com/orlevii/nx-examples)
  2. git checkout delete_app
  3. Run npx nx print-affected --select projects
  4. See that it outputs all the projects in the repository

You can see the changes of this branch here: https://github.com/nrwl/nx-examples/compare/master...orlevii:nx-examples:delete_app

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 20.9.0
   OS     : linux-x64
   yarn   : 1.22.19

   nx                 : 17.2.0-beta.15
   @nx/js             : 17.2.0-beta.15
   @nx/jest           : 17.2.0-beta.15
   @nx/linter         : 17.2.0-beta.15
   @nx/eslint         : 17.2.0-beta.15
   @nx/workspace      : 17.2.0-beta.15
   @nx/angular        : 17.2.0-beta.15
   @nx/cypress        : 17.2.0-beta.15
   @nx/devkit         : 17.2.0-beta.15
   @nx/eslint-plugin  : 17.2.0-beta.15
   @nx/react          : 17.2.0-beta.15
   @nrwl/tao          : 17.2.0-beta.15
   @nx/web            : 17.2.0-beta.15
   @nx/webpack        : 17.2.0-beta.15
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @ngrx/component-store : 17.0.1
   @ngrx/effects         : 17.0.1
   @ngrx/entity          : 17.0.1
   @ngrx/router-store    : 17.0.1
   @ngrx/store           : 17.0.1
   @ngrx/store-devtools  : 17.0.1

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

This issue has huge impact on CI time when deprecating projects, it basically requires to build & test the entire monorepo every time there's a change like that.

AgentEnder commented 4 months ago

Hey 👋 - when deleting projects Nx has no way of knowing what projects depended on it prior to the deletion. To do this, Nx would need to persist changes to the graph over time, and the size of that data would get out of hand quickly.

If we were to remove this logic, it would be possible that projects which should be affected were missed and that's much more dangerous than having the longer CI times.

I'm going to go ahead and close this out. Let me know if you have further questions.

github-actions[bot] commented 3 months 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.