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

let app and upgrade command accept an AppVersion uuid as target version #934

Merged
1 commit merged into from
Dec 5, 2024

Conversation

niristius
Copy link
Contributor

this is my implementation to realize the requested feature from #922

@niristius
Copy link
Contributor Author

upgrades are included too

Copy link
Member

@martin-helmich martin-helmich left a comment

Choose a reason for hiding this comment

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

Some refactoring suggetions; also, mind the linter issues.

appVersionId,
);
} else {
appVersion = await normalizeToAppVersionUuid(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe build the "if it looks like a UUID, just use that"-logic directly into normalizeToAppVersionUuid? IIRC, all other normalize<whatever> functions that we have floating around work more or less similar, anyway.

Comment on lines +118 to +130
} else if (
this.flags["target-version"] &&
validateUuid(this.flags["target-version"])
) {
targetAppVersion = await getAppVersionFromUuid(
this.apiClient,
currentApp.id,
this.flags["target-version"],
);
} else if (
this.flags["target-version"] &&
!validateUuid(this.flags["target-version"])
) {
Copy link
Member

Choose a reason for hiding this comment

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

These ANDed conditions could be deconstructed to (maybe?) more readable nested conditions:

else if (this.flags["target-version"]) {
  if (validateUuid(this.flags["target-version"])) {
    // ...
  } else {
    // ...
  }
} // ...

Also, the way how targetAppVersion is getting more and more complex, with more and more branches in this condition. I would suggest extracting the entire logic of populating targetAppVersion into a function.

@martin-helmich martin-helmich closed this pull request by merging all changes into master in d2260e7 Dec 5, 2024
@martin-helmich martin-helmich deleted the update-install-with-appversionuuid branch December 5, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants