nx icon indicating copy to clipboard operation
nx copied to clipboard

feat(release): updateDependents generator option for versioning

Open JamesHenry opened this issue 1 year ago • 7 comments

Current Behavior

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.

Expected Behavior

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.when = always 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.

Related Issue(s)

Fixes #22268

JamesHenry avatar Apr 16 '24 11:04 JamesHenry

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview May 2, 2024 10:30am

vercel[bot] avatar Apr 16 '24 11:04 vercel[bot]

+1

lme-agicap avatar Apr 19 '24 07:04 lme-agicap

@JamesHenry can you please check also the test transitive updateDependents with projects: Object.values(projectGraph.nodes), // version all projects

I was trying to update your test, But I'm not so sure about all snapshots.

We are using the nx release command with and nx configuration for projects like this "projects": ["libs/*", "!libs/workspace-extensions"], and when we do this for an dep. graph like this we will get strange output with your changes.

image

There is only one change in navigation, but the nx release will produce an changelog entry like this.

+ ## 1.0.2 (2024-04-22)
+
+
+ ### 🐞 Bug Fixes
+
+ - **ci:** fix ci ([*****](https://github.com/*****))
+
+
+ ### 🧱 Updated Dependencies
+
+ - Updated styles to null
+ - Updated badge to null
+ - Updated icons to null
+
+
+ ### ❤️  Thank You
+
+ - Matthias Hempel @fotopixel

I used this settings.

  "updateDependents": {
          "when": "auto",
          "bump": "patch"
        }

fotopixel avatar Apr 22 '24 09:04 fotopixel

Hi @JamesHenry this would be a great addition to our setup. Any way I can help with this PR, to get it over the line?

Thank you!

diosif-cr avatar May 01 '24 14:05 diosif-cr

Thanks @fotopixel I don't think using that unit test would help with what you are describing.

I added a filter to remove any dependency bumps where the newVersion is null, I believe that should take care of the issue you saw.

If you get chance to try the PR build again please let me know otherwise I will request final review on this

JamesHenry avatar May 01 '24 19:05 JamesHenry

I'm really looking forward to this PR being completed.

ChoSeoHwan avatar May 02 '24 08:05 ChoSeoHwan

I'm closing this one in favour of https://github.com/nrwl/nx/pull/23252 which will have enhanced caching for me directly on origin. We will get this merged very soon

JamesHenry avatar May 08 '24 18:05 JamesHenry

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

github-actions[bot] avatar May 18 '24 00:05 github-actions[bot]