Skip to content

Commit

Permalink
chore: improve bump versions script
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbasten17 committed Oct 5, 2020
1 parent 1ad8f8c commit 18fb810
Showing 1 changed file with 46 additions and 7 deletions.
53 changes: 46 additions & 7 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,50 @@ cd "$BIN_DIR/.." || exit 1
cd packages || exit 1

VERSION=$1
PHASE=$2

update_botonic_deps (){
# $template $1
# $VERSION $2
# $PHASE $3
echo " - Updating botonic deps for '$1'"
if [[ "$3" == "rc" ]]
then
sed -i.aux -E 's/("@botonic\/(.*)": )"(.*)"/\1"'${2}'"/' package.json
else
sed -i.aux -E 's/("@botonic\/(.*)": )"(.*)"/\1"~'${2}'"/' package.json
fi
rm package.json.aux
}

if [ -z "$PHASE" ]
for package in botonic-*; do
cd "$package" || exit
echo "Bumping $package to $VERSION"
echo "===================================="

# Update botonic dependencies for every template
if [[ "$package" == "botonic-cli" ]]
then
cd "templates" || exit
for project in *; do
cd "$project"
update_botonic_deps "$project" "$VERSION" "$PHASE"
cd ".."
done
cd ".."
fi

# Update botonic dependencies for packages pointing to other botonic projects
if [ "$package" == "botonic-react" ] || [ "$package" == "botonic-plugin-nlu" ];
then
update_botonic_deps "$package" "$VERSION" "$PHASE"
fi

# Updates package.json and package-lock.json
nice npm version $VERSION > /dev/null
cd ..
done
then exit
fi

for package in botonic-*; do
cd "$package" || exit
echo "Bumping $package to $VERSION"
echo "===================================="
nice npm version $VERSION > /dev/null
cd ..
done

0 comments on commit 18fb810

Please sign in to comment.