Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/bump-version.get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ for FILE in ${VERSFILES} ; do
VERS=$(grep "const Version" < "${FILE}" | sed -e 's/^[^"]*"//' -e 's/"$//')
;;
package.json)
# get the root package's name.
ROOTJSNAME="$(jq -re '.name' < package.json)"
if [ "$(dirname "${FILE}")" = "." ] || ! VERS=$(jq -re ".dependencies[\"${ROOTJSNAME}\"]" < "${FILE}") ; then
# get the root package's name, if there is a root package.json.
ROOTJSNAME=""
if [ -f package.json ] ; then
ROOTJSNAME="$(jq -re '.name' < package.json)"
fi
if [ "$(dirname "${FILE}")" = "." ] || [ -z "${ROOTJSNAME}" ] || ! VERS=$(jq -re ".dependencies[\"${ROOTJSNAME}\"]" < "${FILE}") ; then
# This is the root package.json, so we want .version OR
# This isn't directly dependant on the root package.json, so we assume we're in a monorepo (ie CB yarn workspaces).
VERS=$(jq -re '.version' < "${FILE}")
Expand Down
9 changes: 6 additions & 3 deletions .github/bump-version.set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ for FILE in ${VERSFILES} ; do
;;

package.json)
# Get the root package's name.
ROOTJSNAME="$(jq -re '.name' < package.json)"
if [ "${DIR}" = "." ] || ! jq -re ".dependencies[\"${ROOTJSNAME}\"]" < "${FILE}" ; then
# Get the root package's name, if there is a root package.json.
ROOTJSNAME=""
if [ -f package.json ] ; then
ROOTJSNAME="$(jq -re '.name' < package.json)"
fi
if [ "${DIR}" = "." ] || [ -z "${ROOTJSNAME}" ] || ! jq -re ".dependencies[\"${ROOTJSNAME}\"]" < "${FILE}" ; then
# This is the root package.json, or we're assuming we're in a monorepo because we aren't dependant on the
# root, so we want .version.
jq --indent 4 ".version=\"${NEWVERS}\"" "${FILE}" > "${FILE}.new"
Expand Down
Loading