-
Notifications
You must be signed in to change notification settings - Fork 2
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
Updates Upgrade command to check if local version matches latest before downloading/installing #50
Conversation
…re downloading/installing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Enhanced the CLI's upgrade command with version checking functionality to prevent unnecessary installations and improve user experience.
- Added
getIsOnLatestVersion
function in/src/lib/upgrade.ts
to check current version against GitHub's latest release - Implemented version existence validation before upgrade attempts using GitHub API
- Added early exit conditions when user is already on requested version
- Integrated with existing version display system from
/src/checkVersion.ts
for consistent version checking
💡 (5/5) You can turn off certain types of comments like style here!
1 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
|
||
const latestVersionUrl = | ||
"https://api.github.com/repos/sfcompute/cli/releases/latest"; | ||
const latestVersionResponse = await fetch(latestVersionUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: missing try/catch around fetch - network errors will cause uncaught exceptions
const latestVersionData = await latestVersionResponse.json(); | ||
const latestVersion = latestVersionData.tag_name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: missing try/catch around json parsing and accessing tag_name - malformed response will throw
const latestVersionData = await latestVersionResponse.json(); | ||
const latestVersion = latestVersionData.tag_name; | ||
|
||
return latestVersion === currentVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: version comparison should use semver library for proper version string comparison
No description provided.