fix(cli): use semantic versioning for update check (#1671)

Co-authored-by: Brian <bmadcode@gmail.com>
This commit is contained in:
Alex Verkhovsky 2026-02-16 08:39:03 -07:00 committed by GitHub
parent d4b4bdfa12
commit 8115ad826b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ const { program } = require('commander');
const path = require('node:path');
const fs = require('node:fs');
const { execSync } = require('node:child_process');
const semver = require('semver');
const prompts = require('./lib/prompts');
// The installer flow uses many sequential @clack/prompts, each adding keypress
@ -34,7 +35,7 @@ async function checkForUpdate() {
timeout: 5000,
}).trim();
if (result && result !== packageJson.version) {
if (result && semver.gt(result, packageJson.version)) {
const color = await prompts.getColor();
const updateMsg = [
`You are using version ${packageJson.version} but ${result} is available.`,