fix(update): normalize version strings for correct comparison
Some checks failed
CI / Type Check & Lint (push) Successful in 6s
CI / Build Test (Current Platform) (push) Successful in 5s
Release / build-and-release (push) Failing after 4s
CI / Build All Platforms (push) Has been cancelled

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:
2025-10-19 22:56:12 +00:00
parent c2f2f1e2ee
commit e6ddfd66c5

View File

@@ -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;