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

core: dependsOn local project overrides regression (introduced between nx 19.4 - 19.5) #27258

Closed
2 of 4 tasks
Hotell opened this issue Aug 1, 2024 · 5 comments · Fixed by #27309
Closed
2 of 4 tasks
Assignees
Labels

Comments

@Hotell
Copy link
Contributor

Hotell commented Aug 1, 2024

Current Behavior

dependsOn overrides no longer work

following configuration worked with nx 19.3:

image

with nx 19.5 it doesn't work anymore:

image

Expected Behavior

dependsOn overrides should work as before (merge of inferred target with manually specified bug)

Workaround:

if full target definition is manually provided it works as before

image

GitHub Repo

microsoft/fluentui#32136

Steps to Reproduce

  1. see failing pipeline

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.15.0
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 1.23.34

nx                 : 19.5.4
@nx/js             : 19.5.4
@nx/jest           : 19.5.4
@nx/linter         : 19.5.4
@nx/eslint         : 19.5.4
@nx/workspace      : 19.5.4
@nx/devkit         : 19.5.4
@nx/eslint-plugin  : 19.5.4
@nx/node           : 19.5.4
@nx/plugin         : 19.5.4
@nrwl/tao          : 19.5.4
typescript         : 5.0.4
---------------------------------------
Local workspace plugins:
         @fluentui/workspace-plugin

Failure Logs

No response

Package Manager Version

yarn v1

Operating System

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

Additional Information

No response

@Hotell Hotell changed the title core: dependsOn project overrides regression (introduced between nx 19.3 - 19.5) core: dependsOn local project overrides regression (introduced between nx 19.3 - 19.5) Aug 1, 2024
@JamesHenry JamesHenry added the scope: core core nx functionality label Aug 2, 2024
@AgentEnder
Copy link
Member

@Hotell Can you provide more detail as to what I can clone and try to run from that PR that exhibits the problem? I tried to repro in a fresh run and did not see an issue.

@Hotell
Copy link
Contributor Author

Hotell commented Aug 6, 2024

  1. this is the PR I linked in issue description - chore: migrate to nx 19.5 microsoft/fluentui#32136 - please check it out
  2. all the test-perf are failing because targets are not executed as before ( nx 19.3 ) https://uifabric.visualstudio.com/fabricpublic/_build/results?buildId=355023&view=logs&j=4a446d69-1b32-5c30-7305-e0c1f94959f8
  3. local repro:
    • yarn install
    • yarn nx reset
    • run yarn nx run perf-test:test-perf -> nothing will be run. this is the reported bug
    • perf-test app overrides bundle target to not run dependency build targets ( global nx config ), but it won't run anything, so test-perf wont have any assets ready to be run agains perf test
    • image

So to recap:

Before (nx 19.3)

yarn nx run perf-test:test-perf executes:
-> perf-test:bundle
-> perf-test:test-perf

After (nx 19.5)

yarn nx run perf-test:test-perf executes:
-> nothing

when trying to run bundle directly NX throw error

yarn nx run perf-test:bundle --skip-nx-cache --verbose
yarn run v1.23.34
$ /fluentui/node_modules/.bin/nx run perf-test:bundle --skip-nx-cache --verbose

🚨 NX   Cannot find configuration for task perf-test:bundle


Error: Cannot find configuration for task perf-test:bundle
    at ProcessTasks.createTask (/Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/tasks-runner/create-task-graph.js:141:19)
    at ProcessTasks.processTasks (/Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/tasks-runner/create-task-graph.js:32:39)
    at createTaskGraph (/Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/tasks-runner/create-task-graph.js:180:21)
    at createTaskGraphAndRunValidations (/Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/tasks-runner/run-command.js:68:63)
    at /Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/tasks-runner/run-command.js:96:27
    at handleErrors (/Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/utils/params.js:22:30)
    at runCommand (/Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/tasks-runner/run-command.js:94:52)
    at Object.runOne (/Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/command-line/run/run-one.js:53:59)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/martinhochel/Projects/msft/fluentui/node_modules/nx/src/command-line/run/command-object.js:19:13
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lemme know if you need anything else. ty

@Hotell Hotell changed the title core: dependsOn local project overrides regression (introduced between nx 19.3 - 19.5) core: dependsOn local project overrides regression (introduced between nx 19.4 - 19.5) Aug 6, 2024
@AgentEnder
Copy link
Member

Ok, got a minimal repro locally. Thanks for the info @Hotell 👋

@Hotell
Copy link
Contributor Author

Hotell commented Aug 7, 2024

This team rocks! Thx a ton folks for quick fix. 🍻

FrozenPandaz pushed a commit that referenced this issue Aug 7, 2024
…oject.json file (#27309)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
We don't infer scripts if any info for that target is present in
project.json. This results in the target dissapearing if the user tries
to modify the inferred target by providing info in project.json, for
example by providing dependsOn or similar.

A minimal repro of the issue looks something like this:

> packages/foo/package.json
```json
{
  "name": "foo",
  "scripts": {
    "build": "echo build"
  }
}
```

> packages/foo/project.json
```json
{
  "name": "foo",
  "targets": {
    "build": {
      "dependsOn": []
    }
  }
}
```

Attempting to run `nx build foo` results in "Cannot find configuration
for task foo:build", as we remove the target for not having an executor.

## Expected Behavior
The target remains as it can run the script, so we have to infer the
script to begin with.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27258

(cherry picked from commit 25212e3)
ZackDeRose pushed a commit to ZackDeRose/nx that referenced this issue Aug 8, 2024
…oject.json file (nrwl#27309)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
We don't infer scripts if any info for that target is present in
project.json. This results in the target dissapearing if the user tries
to modify the inferred target by providing info in project.json, for
example by providing dependsOn or similar.

A minimal repro of the issue looks something like this:

> packages/foo/package.json
```json
{
  "name": "foo",
  "scripts": {
    "build": "echo build"
  }
}
```

> packages/foo/project.json
```json
{
  "name": "foo",
  "targets": {
    "build": {
      "dependsOn": []
    }
  }
}
```

Attempting to run `nx build foo` results in "Cannot find configuration
for task foo:build", as we remove the target for not having an executor.

## Expected Behavior
The target remains as it can run the script, so we have to infer the
script to begin with.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes nrwl#27258
Copy link

github-actions bot commented Sep 7, 2024

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 Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants