Skip to content

Commit 253de9b

Browse files
authored
feat(release): updateDependents generator option for versioning, support circular dependencies (#23252)
<!-- 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` --> ## Current Behavior <!-- This is the behavior we have today --> When releasing projects independently, if a dependent project is untouched directly by the changes, it will not have its version updated and there is no way to opt into this behavior. Additionally, circular dependencies between packages are not supported. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> When releasing projects independently, if a dependent project is untouched directly by the changes, **BY DEFAULT** it will not have its version updated, **BUT** you can opt into it always being updated via a generator option (`release.version.generatorOptions.updateDependents = auto` and you can control what kind of semver bump should be applied to the otherwise unchanged dependent project. Transitive local dependents (`A -> B -> C`) will also be updated in this scenario. Additionally, when opted into, such version only changes will appear in the changelog under a new `Updated Dependencies` section. Circular dependencies between packages are now supported for versioning, changelog generation and publishing. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #22268
1 parent 37f02f7 commit 253de9b

15 files changed

+2701
-143
lines changed

e2e/release/src/circular-dependencies.test.ts

+1,142
Large diffs are not rendered by default.

e2e/release/src/independent-projects.test.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ describe('nx release - independent projects', () => {
191191
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
192192
{project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json
193193
{project-name} 📄 Using the provided version specifier "999.9.9-package.3".
194+
{project-name} ⚠️ Warning, the following packages depend on "{project-name}" but have been filtered out via --projects, and therefore will not be updated:
195+
- {project-name}
196+
=> You can adjust this behavior by setting \`version.generatorOptions.updateDependents\` to "auto"
194197
{project-name} ✍️ New version 999.9.9-package.3 written to {project-name}/package.json
195-
{project-name} ✍️ Applying new version 999.9.9-package.3 to 1 package which depends on {project-name}
196198
197199
198200
"name": "@proj/{project-name}",
@@ -201,12 +203,6 @@ describe('nx release - independent projects', () => {
201203
"scripts": {
202204
203205
204-
"dependencies": {
205-
- "@proj/{project-name}": "0.0.0"
206-
+ "@proj/{project-name}": "999.9.9-package.3"
207-
}
208-
209-
210206
NX Staging changed files with git
211207
212208

0 commit comments

Comments
 (0)