Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependsOn shorthand broken when target name matches name of a project in the same repo. #16931

Closed
2 of 4 tasks
acburdine opened this issue May 11, 2023 · 2 comments · Fixed by #16932
Closed
2 of 4 tasks

Comments

@acburdine
Copy link
Contributor

Current Behavior

Noticed this after the Nx v16 update - a number of our dependsOn configurations in various projects in our Nx monorepo were failing to run.

Example: A given repo has two projects: a and core. Project a has a build target and a core target. The build target has "dependsOn": ["core"] set, however whenever nx build a is run, the core target is not invoked. Caching isn't the cause here as far as I can tell, given that the core target is not listed under cacheableOperations in nx.json.

Using the slightly more explicit configuration of "dependsOn": [{ "target": "core" }] works as expected.

Expected Behavior

Prior to the Nx v16 update, the core target in the above example would be correctly invoked before the build target.

GitHub Repo

https://github.com/acburdine/nx-dependson-repro

Steps to Reproduce

  1. Clone the above repo
  2. Run nx build test, see that the core target is not invoked, though the core-2 target is invoked.
  3. Run nx build test-2, see that both the core and core-2 targets are invoked.

Nx Report

Node   : 18.15.0
OS     : darwin x64
npm    : 9.6.3
Hasher : Native

nx (global)    : 16.1.3
nx             : 16.1.4
@nx/js         : 16.1.4
@nx/workspace  : 16.1.4
@nx/devkit     : 16.1.4
@nrwl/tao      : 16.1.4
typescript     : 5.0.4

Failure Logs

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

If I had to guess, this may be related to the changes in v16 allowing for dependsOn configurations to specify explicit projects, rather than just dependencies or self.

@acburdine
Copy link
Contributor Author

After poking around in the code - I figured out where the issue is, and after reading it realized it may be an intentional change. That said, if it is an intentional change, it should be better documented to avoid folks running into this issue.

acburdine added a commit to acburdine/nx that referenced this issue May 11, 2023
closes nrwl#16931
- if a project has a `dependsOn` string with only a target that has the same
  name as another project, it is now treated correctly as a reference to
  a target in the same project
acburdine added a commit to acburdine/nx that referenced this issue May 11, 2023
closes nrwl#16931
- if a project has a `dependsOn` string with only a target that has the same
  name as another project, it is now treated correctly as a reference to
  a target in the same project
acburdine added a commit to acburdine/nx that referenced this issue May 11, 2023
closes nrwl#16931
- if a project has a `dependsOn` string with only a target that has the same
  name as another project, it is now treated correctly as a reference to
  a target in the same project
acburdine added a commit to acburdine/nx that referenced this issue May 11, 2023
closes nrwl#16931
- if a project has a `dependsOn` string with only a target that has the same
  name as another project, it is now treated correctly as a reference to
  a target in the same project
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant