File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -92,13 +92,15 @@ case $update in
92
92
;;
93
93
esac
94
94
95
+ pkg=$( [[ -f package.json ]] && grep -q " \" version\" :" package.json && echo true || echo false)
96
+
95
97
# inform about changes and ask to continue
96
98
banner
97
99
printf " \n\n Current Branch: $( [[ " $branch " = " main" || " $branch " = " master" ]] && echo " $g " || echo " $r " ) ${b}${branch}${x} "
98
100
printf " \n\n Latest Version: $( [[ " $latest " = " v0.0.0" ]] && echo " ${r}${b} N/A${x} " || echo " ${b}${latest}${x} " ) "
99
101
printf " \n\n New Version: ${y}${b}${new}${x} "
100
102
printf " \n\nContinue to create the version tag and push it to the git remote."
101
- [[ -f package.json ]] && printf " \nThe version field in the package.json will be updated and committed."
103
+ $pkg && printf " \nThe version field in the package.json will be updated and committed."
102
104
printf " \n\n${gr} (press ANY KEY to continue or ESCAPE to cancel)${x} \n"
103
105
read -rsn1 key
104
106
@@ -119,7 +121,7 @@ message="Release ${new}"
119
121
set -e
120
122
121
123
# update and commit package.json if present
122
- if [[ -f package.json ]] ; then
124
+ if $pkg ; then
123
125
xsed " s/(\" version\" :[[:space:]]*\" )(.+)(\" )/\1${new} \3/g" package.json
124
126
git add package.json
125
127
git commit -m " $message "
You can’t perform that action at this time.
0 commit comments