fix(update): normalize version strings for correct comparison
The version check was comparing "4.0.8" (no prefix) with "v4.0.8" (with prefix), causing it to always think an update was available. Now both versions are normalized to have the "v" prefix before comparison, so "Already up to date!" works correctly.
This commit is contained in:
@@ -145,12 +145,16 @@ export class ServiceHandler {
|
||||
const release = JSON.parse(response);
|
||||
const latestVersion = release.tag_name; // e.g., "v4.0.7"
|
||||
|
||||
logger.dim(`Current version: ${currentVersion}`);
|
||||
logger.dim(`Latest version: ${latestVersion}`);
|
||||
// Normalize versions for comparison (ensure both have "v" prefix)
|
||||
const normalizedCurrent = currentVersion.startsWith('v') ? currentVersion : `v${currentVersion}`;
|
||||
const normalizedLatest = latestVersion.startsWith('v') ? latestVersion : `v${latestVersion}`;
|
||||
|
||||
logger.dim(`Current version: ${normalizedCurrent}`);
|
||||
logger.dim(`Latest version: ${normalizedLatest}`);
|
||||
console.log('');
|
||||
|
||||
// Compare versions (both are in format "v4.0.7")
|
||||
if (currentVersion === latestVersion) {
|
||||
// Compare normalized versions
|
||||
if (normalizedCurrent === normalizedLatest) {
|
||||
logger.success('Already up to date!');
|
||||
console.log('');
|
||||
return;
|
||||
|
Reference in New Issue
Block a user