Skip to content

Commit

Permalink
feat: if package.json exists then will update it with new version too…
Browse files Browse the repository at this point in the history
… in ship.version (#15)
  • Loading branch information
basejump authored Aug 4, 2021
1 parent c3ab891 commit ef9485d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/semver
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ function bump_version_file {
local newVersion=$( bump_patch "$publishingVersion")
local versionFile=${2:-version.properties}
updateVersionFile "$newVersion" "$publishingVersion" "$versionFile" "${3}"
update_package_json "$newVersion"
}

# if package.json exists then update it with new version
# $1 - the new version
function update_package_json {
if [ -f package.json ]; then
sed -i.bak -e "s|\"version\":.*|\"version\": \"${1}\",|g" package.json && rm -- "package.json.bak"
# add it so it gets picked up in the push
git add package.json
fi
}

# Updates version.properties with given version, sets publishedVersion to the $VERSION
Expand Down

0 comments on commit ef9485d

Please sign in to comment.