-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
nx-release-publish default target dependsOn is ignored #27749
Comments
I found also a different "hacky" way to get same, by adding a dummy section to each project package.json:
to my opinion there must be no difference between this task and others. If we create a proper task inference plugin , there will be no need in this extra step. |
The fact that we run a target called We can do a much better job of not having our configuration expose this implementation detail so strongly (the custom Until then, I have provided the recommended guidance for running dependent tasks before releases in other issues but I will repeat them here and add them to the documentation until the above change lands. To me, publishing is the act of taking an already finalized artifact and adding it to a registry. It is not the point at which you prepare that relevant artifact. This is why we have the You do have two additional mechanisms available to you as well, however:
|
Unfortuanately preversion command will not work in our case because of a simple reason:
With a change introduced by this PR the only required command in CI/CD is : With properly maintained dependencies it will execute all required tasks right in CI/CD. |
@JamesHenry following mentioned above problem what could be a workaround solution ( at least to stay consistend with the current approach ) is kind of prepublish command which will be called prior to publish, not version |
Another idea which I really like about having release/publish as interference plugin, is that in this case we can utilze the full scope of commands, like It would be nice to have something like: nx affected publish ( where publish has a dedicated executor like @nx/release-publish ) and then we can just use it as a task, not as a separate functionality. We may reach better flexibility . |
@ThePlenkov both of the additional options I outlined will work in your case, the npm scripts are also part of the project graph, for example. There is nothing wrong with these solutions, as you seem to be implying. Nevertheless, I have opened a PR with a more appropriate update to the implicit target logic (commenting out a line of code which was important to functionality ensuring correctness was never going to be a viable solution). It is in draft pending discussion with the team: #27764 RE: Affected: Affected as a mechanism would only say that a project is affected within a particular commit range. You could use this to infer what needs to be released, but it wouldn't say what the new version should be. That's why we have different options for determining the new version: imperatively via the CLI, conventional commits, and version plans. Conventional commits and version plans already determine what is "affected" based on the semver bump data that is encoded within them. We could potentially explore what an affected imperative versioning would look like, but again, it's a question of what the bump should be. Some projects could be "affected" but want a patch, whereas others want a minor release. Having only publishing be combined with affected is also problematic, because again, affected refers to a project being impacted by git changes, which is not necessarily related to the desire to publish, because the artifact you are publishing is usually mostly outside git (entirely in some cases, like the Nx repo where we version and publish from dist and use the registry as the source of truth for versioning). Nx release needs to generically support a large number of different approaches, so we can't just add things without considering the ripple effect for all use-cases. |
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. |
Current Behavior
I would like to make sure that project is built, tested and linted before publishing. To achieve this I maintain a default target in nx.json like this
However when I run a command
nx release
those tasks are ignored.So I noticed that in a project graph which I get with
nx graph --file=graph.json
command my projects have a target nx-release-publish, but dependsOn is overwritten withdependsOn: ['^nx-release-publish']
.I quickly found a place in a code which creates this problem:
in the file
node_modules/nx/src/utils/package-json.js
Commenting dependsOn line in this code fully solves my problem. I'd like to propose a PR to elaborate on this apporach
Expected Behavior
If default target is maintained - it should take dependsOn from that target as it works for the rest of the project graph. I propose not to make nx-release-publish such a special target.
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: