Skip to content
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

feat(release): updateDependents generator option for versioning #22836

Conversation

JamesHenry
Copy link
Collaborator

@JamesHenry JamesHenry commented Apr 16, 2024

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

Copy link

vercel bot commented Apr 16, 2024

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

@lme-agicap
Copy link

+1

@fotopixel
Copy link

@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"
        }

@diosif-cr
Copy link

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!

@JamesHenry
Copy link
Collaborator Author

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

@@ -73,6 +73,12 @@ export interface ReleaseVersionGeneratorSchema {
installArgs?: string;
installIgnoreScripts?: boolean;
conventionalCommitsConfig?: NxReleaseConfig['conventionalCommits'];
updateDependents?: {
// "auto" means "only when the dependents are already included in the current batch", and is the default
when?: 'auto' | 'always';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
when?: 'auto' | 'always';
when?: 'never' | 'auto';

never is the current behavior. No dependents are updated.
auto is the new behavior and will remain ambiguous with what we think is best.

We may add more in the future.

// "auto" means "only when the dependents are already included in the current batch", and is the default
when?: 'auto' | 'always';
// in the case "when" is set to "always", what semver bump should be applied to the dependents which are not included in the current batch
bump?: 'patch' | 'minor' | 'major';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm honestly not sure at this time what should be the logic here. Can we start off with just patch? We can change the behavior when we have more use cases in mind.

@ChoSeoHwan
Copy link

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

@JamesHenry
Copy link
Collaborator Author

I'm closing this one in favour of #23252 which will have enhanced caching for me directly on origin. We will get this merged very soon

@JamesHenry JamesHenry closed this May 8, 2024
@JamesHenry JamesHenry deleted the updated--release-version-update-dependents-options branch May 8, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants