From 070258e532755f0cf9e1e66fad0075143643d277 Mon Sep 17 00:00:00 2001 From: urizennnn Date: Sun, 2 Jun 2024 18:06:19 +0100 Subject: [PATCH] fix:fixed if statement check in root --- .npmignore | 1 + lib/cmd/root.go | 6 ++++-- package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.npmignore b/.npmignore index 789e61c..52ff963 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ packages +lib test .* tsconfig.json diff --git a/lib/cmd/root.go b/lib/cmd/root.go index 4dc014d..64448c8 100644 --- a/lib/cmd/root.go +++ b/lib/cmd/root.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" "os" + "strings" "github.com/spf13/cobra" "github.com/urizennnn/express-cli/lib/functions/config" @@ -21,7 +22,7 @@ const ( packageName = "@urizen/express-cli" ) -var linstalledVersion = Version() +var installedVersion = strings.TrimSpace(Version()) // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. @@ -30,7 +31,8 @@ func Execute() { if err != nil { os.Exit(1) } - if version != linstalledVersion { + version = strings.TrimSpace(version) + if version != installedVersion { fmt.Printf(config.Red+"A new version of %s is available. Run `npm install -g %s` to update.\n"+config.Reset, packageName, packageName) } err = rootCmd.Execute() diff --git a/package.json b/package.json index 56c460d..983f74c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@urizen/express-cli", - "version": "2.3.3", + "version": "2.3.4", "license": "MIT", "bin": { "express": "bin/linux"