From 95fa4f8b0bdffcc7ccecafeb0c7fa77f5246461e Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sun, 19 Oct 2025 22:56:12 +0000 Subject: [PATCH] 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. --- deno.json | 2 +- ts/cli/service-handler.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/deno.json b/deno.json index 2e737f7..bd43da7 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@serve.zone/nupst", - "version": "4.0.8", + "version": "4.0.9", "exports": "./mod.ts", "tasks": { "dev": "deno run --allow-all mod.ts", diff --git a/ts/cli/service-handler.ts b/ts/cli/service-handler.ts index 2ee52c7..725ef81 100644 --- a/ts/cli/service-handler.ts +++ b/ts/cli/service-handler.ts @@ -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;