-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fails when using a custom dist
directory, independent
mode, and conventional-commits
.
#27887
Comments
Any update? We're unable to publish packages using the configuration shown in the ClipboardHealth/nx-release-repro. Ideally, we'd be able to keep the
|
@therockstorm I am taking a look at this now, will let you know if I have any clarifying questions |
Regarding affected, I'd like to please clarify your expectations and what you feel you are missing from conventional commits in this aspect? Conventional commits should already be the source of truth for what projects are "affected"? Nx affected deals with what projects are affected between a particular commit range, but this doesn't necessarily map to what should be released. I shared some thoughts on that previously here: #27749 (comment) Please could you elaborate on why affected is needed/desirable on top of conventional commits and independent releases? PS I am kind of blown away by the number of upvotes on this issue in such a short space of time, are they largely colleagues of yours or something? Even a blocking bug (which this isn't) wouldn't usually garner this much attention in this short a time span 🤔 |
The improvement covered in comment #27887 (comment) is open as a PR here #28034 |
I'm indifferent to "affected" while releasing and agree with the distinctions you bring up. The problem is that following these docs to remove versions and add the two I think I got it working by removing
So {
"release": {
"git": {
"commit": true
},
"projects": ["packages/*"],
"projectsRelationship": "independent",
"version": {
"generatorOptions": {
"currentVersionResolver": "git-tag",
"fallbackCurrentVersionResolver": "disk",
"specifierSource": "conventional-commits",
"updateDependents": "auto"
}
}
},
"nx-release-publish": { "options": { "packageRoot": "dist/packages/{projectName}" } }
} Maybe the "fix" here is just a documentation update? It would also be helpful if Having gone through the code trying to figure out why it wasn't working, I see just how many configuration permutations |
Thanks @therockstorm, I agree these docs could do with a refresh to improve clarity, I will work on that very soon once I add another feature in this area that will also impact the docs. A couple of points on the above: Rather than setting the "version": {
"conventionalCommits": true
} Which implicitly sets the same things behind the scenes (https://nx.dev/recipes/nx-release/automatically-version-with-conventional-commits). There reason the schema population for generatorOptions was not done was for consistency. Versioning is intentionally pluggable for all languages/ecosystems not just JavaScript with npm. The |
Hi @JamesHenry Thanks for all the efforts with this nx target. I have question regarding currentVersionResolver if it is set to "registry" can the "specifier-source " still be set to "conventional-commits"? We have a challenge with git-tags as they can create conflicts between developers' PRs. Thanks |
I'm sorry for the delay @jakachira, the range of commits needs to be established to parse the conventional commits. Git tags are easily the most natural way to do that. The only other option would be providing some way for a developer to imperative tell Nx a starting SHA to consider, but I don't think most people would find that intuitive. Please open a fresh issue to discuss the conflicts you are referring, it's not related to this issue anyway. @therockstorm I'm pleased to say that there is a rewritten implementation of versioning here #30418 that has further solidified the generated libraries' relationship with Once it lands we can look with fresh eyes at this one and see if there is anything else to be done here. |
Current Behavior
The Nx generators
@nx/node:lib
and@nx/js:lib
put thedist
directory at the repository root, so that's what I'm doing. I'm also using conventional commits for version bumps. Taken together, it means I can't usedisk
to resolve versions and after following this Nx documentation, I removed theversion
field frompackage.json
files.This configuration breaks
nx release
because it tries to publish every package, but any that haven't changed don't have aversion
field in thepackage.json
file in thedist
directory.This discussion suggests using
nx show projects --affected
to pass only affected packages tonx release --projects="lib-a,..."
, but that solution doesn't work. If I change thenx.json
file, for example,nx show projects --affected
lists every package, butnx release
doesn't update any of them. Instead, it shows,Skipping versioning "lib-a" as no changes were detected
.Aside: while creating the repo to reproduce the issue, I ran into another issue: in a fresh Nx monorepo, I add a library via
npx nx g lib lib-a --directory=packages/lib-a
and then remove theversion
field frompackage.json
. This breaksnx release --first-release
, throwingUnable to resolve the current version from git tag using pattern "{projectName}@{version}". Falling back to the version on disk of undefined
. I worked around this by adding the version back, publishing, and then removing it.Expected Behavior
I expect that using the Nx generators and following the Nx documentation results in my packages publishing without error.
GitHub Repo
https://github.com/ClipboardHealth/nx-release-repro
Steps to Reproduce
lib-a
returns here.git commit --all --message "fix: make a change"
.nx release --yes
and receive an error.Nx Report
Failure Logs
Package Manager Version
10.8.3
Operating System
Additional Information
I've spent weeks on and off trying to get
nx release
working, any help would be greatly appreciated, @fahslaj @JamesHenry.The text was updated successfully, but these errors were encountered: