Skip to content

Commit

Permalink
fix:fixed if statement check in root
Browse files Browse the repository at this point in the history
  • Loading branch information
urizennnn committed Jun 2, 2024
1 parent 13a91af commit 070258e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
packages
lib
test
.*
tsconfig.json
Expand Down
6 changes: 4 additions & 2 deletions lib/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"os"
"strings"

"github.com/spf13/cobra"
"github.com/urizennnn/express-cli/lib/functions/config"
Expand All @@ -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.
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@urizen/express-cli",
"version": "2.3.3",
"version": "2.3.4",
"license": "MIT",
"bin": {
"express": "bin/linux"
Expand Down

0 comments on commit 070258e

Please sign in to comment.