|
|
@ -1,6 +1,5 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
function usage() { |
|
|
|
echo 'usage: --major | -M | --minor | -m | --patch | -p' |
|
|
|
exit 1 |
|
|
@ -34,8 +33,6 @@ function setCommand() { |
|
|
|
|
|
|
|
############# main |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check git covered |
|
|
|
REPOSITORY=$(git config --get remote.origin.url) |
|
|
|
if [[ "$?" -ne 0 ]]; then |
|
|
@ -131,13 +128,13 @@ GIT_ROOT_FOLDER=$(dirname $(git rev-parse --git-dir)) |
|
|
|
if [[ -f "${GIT_ROOT_FOLDER}/package.json" ]]; then |
|
|
|
|
|
|
|
echo "package.json detected, version replaced with new tag <${TAG}>" |
|
|
|
if ! command -v jq &>/dev/null; then |
|
|
|
echo 'command <jq> not found, hint: `sudo apt install jq`' |
|
|
|
if ! command -v yq &>/dev/null; then |
|
|
|
echo 'command <yq> not found, hint: go and fetch latest release from https://github.com/mikefarah/yq' |
|
|
|
exit 5 |
|
|
|
fi |
|
|
|
|
|
|
|
tmp=$(mktemp) |
|
|
|
jq '.version = $TAG' --arg TAG $TAG "${GIT_ROOT_FOLDER}/package.json" >"$tmp" && mv "$tmp" "${GIT_ROOT_FOLDER}/package.json" |
|
|
|
yq ".version = $TAG" "${GIT_ROOT_FOLDER}/package.json" >"$tmp" && mv "$tmp" "${GIT_ROOT_FOLDER}/package.json" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|