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
fix(run): fully defer to Nx for dep detection when nx.json exists #3345
fix(run): fully defer to Nx for dep detection when nx.json exists #3345
Conversation
FYI this introduces a regression in 5.5.4 where i have an nx.json (default file) and suddenly the order of |
@alasdairhurst please open an issue with a reproduction |
Actually @alasdairhurst if you could provide the contents of your |
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": []
}
}
}
} |
We have quite a complex setup (There's 46 modules with a number of interdependencies.) but i'll see if i can find time to set up something and try to build a reproduction to help you out if you're not sure about the root of the issue yet. Since nobody else has reported the issue surprisingly, it seems like it could be slightly more in depth than i was expecting. Let me know if there's any other info/logs/config that could help you pinpoint the issue that i can provide from my current monorepo. |
Ah right, no it's ok @alasdairhurst you were right in your initial point. This change here has made it so that the presence of Nx's task runner doesn't just understand dependencies at a package/project level, it also understands them at a script (a.k.a "target") level. Therefore when the
For example, if you have a nx.json {
...
"targetDefaults": {
"build": {
"dependsOn": [
"^build"
]
}
}
} ( We are adding a helper command to the lerna CLI which will give you an interactive prompt to help you generate this configuration (and will then update the docs accordingly once that lands), but until then you'll just need to configure your nx.json based on the above. Please let me know if you face any issues with that and I can help out! |
Thanks a lot for the detailed description! I'll look into applying this as you suggested. I'll explain how i recall that got to this configuration in case the current setup i have was a bit of an oversight when making this change. Maybe there could be some improvements to make in the default nx configuration? I updated to the latest version of lerna when nx got integrated. At this point, i was able to install nx, set "useNx" to true in lerna.json and everything worked as per the migration guide (only followed the required steps), and get the cool new behavior for A few weeks ago, the change in behavior i'm seeing currently suddenly appeared (build order changed and everything started running in parallel without taking into account dependencies). running "nx init" (had to run it in a different project since it was already installed in my monorepo) allowed us to generate the default nx.json as i posted above, and this returned to the previous Then it seems like adding the nx.json as a solution was a double-edged sword since the behavior reverted again in the last release and impacts when you have the (default) nx.json :) Note that the nx.json created from nx init, and the nx.json in the lerna migration guide (https://nx.dev/recipe/lerna-and-nx) doesn't include targetDefaults, but at the time that I upgraded, this was the default behavior, now it won't be for users following the same process, and i presume by default if they follow the optional step to create nx.json and leave it as-is then I'll leave the rest up to you guys. Just letting you know my experience and hopefully it is useful. |
@alasdairhurst thank you for the feedback, we do agree and want to help bridge the gap, so Austin is working on a refinement to it here: #3349 The new |
Description
--include-dependencies
to indicate that Lerna will send Nx additional dependencies to run.lerna run
will behave differently and links to the page describing the differences.How Has This Been Tested?
This change has been covered by e2e tests and tested manually.
Types of changes
Checklist: