-
Notifications
You must be signed in to change notification settings - Fork 348
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
feature request: telling user when new version is available #35
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5449d5c
1.1.12
di-sukharev b3509e3
1.1.13
di-sukharev 8f0a322
1.1.14
di-sukharev 0f33b74
1.1.15
di-sukharev 0092e92
1.1.16
di-sukharev 83c77eb
✨ feat(cli.ts): add checkIsLatestVersion function
nader-zouaoui 5b4c0a8
Update checkIsLatestVersion.ts
nader-zouaoui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
✨ feat(cli.ts): add checkIsLatestVersion function
This commit adds a new function that checks if the current version of OpenCommit is the latest version. The function uses the getOpenCommitLatestVersion function from the api module to get the latest version of OpenCommit. If the current version is not the latest version, a warning message is printed to the console, informing the user to update to the latest version to get the latest features and bug fixes.
- Loading branch information
commit 83c77eb5009389b4e4c9ed1e8c75effa0e3b2307
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { getOpenCommitLatestVersion } from '../api'; | ||
import currentPackage from '../../package.json' assert { type: 'json' }; | ||
import chalk from 'chalk'; | ||
export const checkIsLatestVersion = async () => { | ||
const latestVersion = await getOpenCommitLatestVersion(); | ||
|
||
if (latestVersion) { | ||
const currentVersion = currentPackage.version; | ||
|
||
if (currentVersion !== latestVersion) { | ||
console.warn( | ||
chalk.yellow( | ||
` | ||
You are not using the latest stable version of OpenCommit! | ||
consider updating to the latest version to get the latest features and bug fixes. | ||
Current version: ${currentVersion} | ||
Latest version: ${latestVersion} | ||
` | ||
) | ||
); | ||
} | ||
} | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@nader-zouaoui What do you think about already suggesting the command to perform the update? ex:
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.
Makes sense, will do it