-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(repo): add command line tool to update versions in all packages (…
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
if ! command -v melos &> /dev/null | ||
then | ||
echo "melos could not be found" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v yq &> /dev/null | ||
then | ||
echo "yq could not be found" | ||
exit 1 | ||
fi | ||
|
||
if [ $# -eq 0 ] | ||
then | ||
echo "You must provide a version number" | ||
echo "Usage: ./tools/version.sh 1.0.0" | ||
exit 1 | ||
fi | ||
|
||
VERSION=$1 | ||
|
||
echo "Checking melos.yaml for packages" | ||
|
||
PACKAGES_PATH=$(yq eval '.packages' melos.yaml | tr -d '-' | tr -d '*') | ||
PACKAGES=$(cd $PACKAGES_PATH && ls -d */ | tr -d '/') | ||
|
||
COMMAND="melos version --no-git-tag-version --no-changelog" | ||
|
||
for PACKAGE in $PACKAGES | ||
do | ||
echo "Setting version $VERSION for $PACKAGE" | ||
COMMAND+=" -V $PACKAGE:$VERSION" | ||
done | ||
|
||
eval $COMMAND | ||
|
||
VERSION_FILE=$PWD/packages/stream_chat/lib/version.dart | ||
|
||
echo "Updating $VERSION_FILE" | ||
|
||
echo "$(cat $VERSION_FILE | sed -E "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/g")" > $PWD/packages/stream_chat/lib/version.dart |