Skip to content

Commit

Permalink
feat(release): updateDependents generator option for versioning, supp…
Browse files Browse the repository at this point in the history
…ort 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
  • Loading branch information
JamesHenry authored May 23, 2024
1 parent 37f02f7 commit 253de9b
Show file tree
Hide file tree
Showing 15 changed files with 2,701 additions and 143 deletions.
1,142 changes: 1,142 additions & 0 deletions e2e/release/src/circular-dependencies.test.ts

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions e2e/release/src/independent-projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ describe('nx release - independent projects', () => {
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json
{project-name} 📄 Using the provided version specifier "999.9.9-package.3".
{project-name} ⚠️ Warning, the following packages depend on "{project-name}" but have been filtered out via --projects, and therefore will not be updated:
- {project-name}
=> You can adjust this behavior by setting \`version.generatorOptions.updateDependents\` to "auto"
{project-name} ✍️ New version 999.9.9-package.3 written to {project-name}/package.json
{project-name} ✍️ Applying new version 999.9.9-package.3 to 1 package which depends on {project-name}
"name": "@proj/{project-name}",
Expand All @@ -201,12 +203,6 @@ describe('nx release - independent projects', () => {
"scripts": {
"dependencies": {
- "@proj/{project-name}": "0.0.0"
+ "@proj/{project-name}": "999.9.9-package.3"
}
NX Staging changed files with git
Expand Down
Loading

0 comments on commit 253de9b

Please sign in to comment.