You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implicit dependencies for nx.json and package.json are overridden in getImplicitlyTouchedProjects to make all projects implicitly dependent on any changes to them. E.g., adding or updating a dependency in package.json causes all packages to be considered affected, regardless of the implicitDependencies setting in nx.json.
This is a regression from a previous version, although I haven't nailed down which version introduced this change yet. It works correctly with @nrwl/[email protected] and
Expected Behavior
Adding or updating a dependency in package.json should only cause the packages that reference that dependency to be affected, plus any packages specified in implicitDependencies in nx.json.
Steps to Reproduce
Verify there are no outstanding affected projects.
> npx create-nx-workspace@latest --name package-json-test --preset angular --style scss --nxCloud=false --appName frontend
>cd package-json-test
> git status
On branch main
nothing to commit, working tree clean
> nx print-affected | jq '.projects'
[]
Add any package to package.json or edit package.json in any way.
These projects (all the projects in the workspace) should not be present since nothing depends on random-package.
For comparison Nx 11 & 12 output:
[
"npm:random-package"
]
and Nx 13 outputs:
[]
Reproduction 2
Here is another reproduction that shows the issue from the perspective of an existing dependency: nrwl/nx-examples#227
Environment
> NX Report complete - copy this into the issue template
Node : 16.15.1
OS : linux x64
pnpm : 7.11.0
nx : 14.7.5
@nrwl/angular : 14.7.5
@nrwl/cypress : 14.7.5
@nrwl/detox : Not Found
@nrwl/devkit : 14.7.5
@nrwl/eslint-plugin-nx : 14.7.5
@nrwl/express : Not Found
@nrwl/jest : 14.7.5
@nrwl/js : 14.7.5
@nrwl/linter : 14.7.5
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.7.5
@nrwl/web : 14.7.5
@nrwl/workspace : 14.7.5
typescript : 4.8.3
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
Other
In trying to see if I was setting options incorrectly, I traced the nx print-affected operation and think the issue lies at least partially in:
FrozenPandaz
changed the title
Updating package.json or nx.json in any capacity causes all projects to be affected
Updating package.json in any capacity causes all projects to be affected
Sep 23, 2022
For nx.json, this is accurate. Because we don't store projects in nx.json anymore, pretty much any change to the file will be affect how Nx runs commands (hence affecting all projects it would run)
As for package.json, @meeroslav is working on something that will fix this.
Current Behavior
The implicit dependencies for
nx.json
andpackage.json
are overridden ingetImplicitlyTouchedProjects
to make all projects implicitly dependent on any changes to them. E.g., adding or updating a dependency inpackage.json
causes all packages to be considered affected, regardless of theimplicitDependencies
setting innx.json
.This is a regression from a previous version, although I haven't nailed down which version introduced this change yet. It works correctly with
@nrwl/[email protected]
andExpected Behavior
Adding or updating a dependency in
package.json
should only cause the packages that reference that dependency to be affected, plus any packages specified inimplicitDependencies
innx.json
.Steps to Reproduce
These projects (all the projects in the workspace) should not be present since nothing depends on
random-package
.For comparison Nx 11 & 12 output:
[ "npm:random-package" ]
and Nx 13 outputs:
Reproduction 2
Here is another reproduction that shows the issue from the perspective of an existing dependency: nrwl/nx-examples#227
Environment
Other
In trying to see if I was setting options incorrectly, I traced the
nx print-affected
operation and think the issue lies at least partially in:nx/packages/nx/src/project-graph/affected/locators/workspace-projects.ts
Lines 34 to 42 in 4247956
As I understand it, this code effectively ignores the
nx.json
implicitDependencies
setting fornx.json
andpackage.json
, and treats it as thoughwere present.
The text was updated successfully, but these errors were encountered: