Skip to content

Commit

Permalink
[version] Handle when package.json doesn't have a version but `Carg…
Browse files Browse the repository at this point in the history
…o.toml` does.
  • Loading branch information
lgarron committed Nov 15, 2024
1 parent a838a10 commit b288c9e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/git/version.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ function js_version
if not test -f package.json
return 1
end
set VERSION (cat package.json | jq -r -e ".version")
if not set VERSION (cat package.json | jq -r -e ".version")
return 1
end
echo -n "v$VERSION"
end

Expand All @@ -13,7 +15,9 @@ function previous_js_version
return 1
end

set PREVIOUS_VERSION (git show HEAD~:package.json | jq -r -e ".version")
if not set set PREVIOUS_VERSION (git show HEAD~:package.json | jq -r -e ".version")
return 1
end
echo -n "v$PREVIOUS_VERSION"
end

Expand Down

0 comments on commit b288c9e

Please sign in to comment.