diff --git a/npm/app/package.json b/npm/app/package.json index 827edb6..dcf89fd 100644 --- a/npm/app/package.json +++ b/npm/app/package.json @@ -41,13 +41,14 @@ "typescript": "^5.2.2" }, "optionalDependencies": { - "@nushell/windows-x64": "0.90.1", - "@nushell/windows-arm64": "0.90.1", - "@nushell/linux-x64": "0.90.1", - "@nushell/linux-arm64": "0.90.1", - "@nushell/linux-arm": "0.90.1", + "@nushell/darwin-arm64": "0.90.1", "@nushell/darwin-x64": "0.90.1", - "@nushell/darwin-arm64": "0.90.1" + "@nushell/linux-arm": "0.90.1", + "@nushell/linux-arm64": "0.90.1", + "@nushell/linux-riscv64": "0.89.0", + "@nushell/linux-x64": "0.90.1", + "@nushell/windows-arm64": "0.90.1", + "@nushell/windows-x64": "0.90.1" }, "eslintConfig": { "extends": [ diff --git a/nu/bump-ver.nu b/nu/bump-ver.nu index 87e689e..c9ce288 100644 --- a/nu/bump-ver.nu +++ b/nu/bump-ver.nu @@ -16,7 +16,7 @@ def main [ '@nushell/darwin-x64': 'x86_64-apple-darwin', '@nushell/linux-arm': 'armv7-unknown-linux-gnueabihf', '@nushell/linux-arm64': 'aarch64-unknown-linux-gnu', - # '@nushell/linux-riscv64': 'riscv64gc-unknown-linux-gnu', + '@nushell/linux-riscv64': 'riscv64gc-unknown-linux-gnu', '@nushell/linux-x64': 'x86_64-unknown-linux-musl', '@nushell/windows-arm64': 'aarch64-pc-windows-msvc', '@nushell/windows-x64': 'x86_64-pc-windows-msvc', diff --git a/nu/common.nu b/nu/common.nu index 57117b8..ba1960e 100644 --- a/nu/common.nu +++ b/nu/common.nu @@ -27,34 +27,35 @@ export def 'is-installed' [ app: string ] { (which $app | length) > 0 } -# Compare two version number, return `true` if first one is higher than second one, -# Return `null` if they are equal, otherwise return `false` -export def 'compare-ver' [ +# Compare two version number, return `1` if first one is higher than second one, +# Return `0` if they are equal, otherwise return `-1` +export def compare-ver [ from: string, to: string, ] { let dest = ($to | str downcase | str trim -c 'v' | str trim) let source = ($from | str downcase | str trim -c 'v' | str trim) - let v1 = ($source | split row '.' | each {|it| ($it | into int)}) - let v2 = ($dest | split row '.' | each {|it| ($it | into int)}) + # Ignore '-beta' or '-rc' suffix + let v1 = ($source | split row '.' | each {|it| ($it | parse -r '(?P\d+)' | get v | get 0 )}) + let v2 = ($dest | split row '.' | each {|it| ($it | parse -r '(?P\d+)' | get v | get 0 )}) for $v in $v1 -n { - let c1 = ($v1 | get -i $v.index | default 0) - let c2 = ($v2 | get -i $v.index | default 0) + let c1 = ($v1 | get -i $v.index | default 0 | into int) + let c2 = ($v2 | get -i $v.index | default 0 | into int) if $c1 > $c2 { - return true + return 1 } else if ($c1 < $c2) { - return false + return (-1) } } - return null + return 0 } # Compare two version number, return true if first one is lower then second one -export def 'is-lower-ver' [ +export def is-lower-ver [ from: string, to: string, ] { - (compare-ver $from $to) == false + (compare-ver $from $to) < 0 } # Check if git was installed and if current directory is a git repo diff --git a/nu/npm.nu b/nu/npm.nu index fd2ffdb..a63e48a 100644 --- a/nu/npm.nu +++ b/nu/npm.nu @@ -33,7 +33,7 @@ let pkgs = [ 'aarch64-apple-darwin' 'aarch64-unknown-linux-gnu' 'armv7-unknown-linux-gnueabihf' - # 'riscv64gc-unknown-linux-gnu' + 'riscv64gc-unknown-linux-gnu' 'x86_64-apple-darwin' 'x86_64-pc-windows-msvc' 'aarch64-pc-windows-msvc' diff --git a/nu/typos.nu b/nu/typos.nu index 9fe12c0..4b6e2dc 100644 --- a/nu/typos.nu +++ b/nu/typos.nu @@ -2,7 +2,7 @@ def main [output: string] { - if not (which typos | length) > 0 { + if not ((which typos | length) > 0) { print $'(ansi y)[WARN]: (ansi reset)`Typos` not installed, please install it by running `brew install typos-cli`...' exit 2 }