Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve bump versions script #971

Merged
merged 1 commit into from
Oct 5, 2020
Merged
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
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