Skip to content

Commit

Permalink
chore(repo): add command line tool to update versions in all packages (
Browse files Browse the repository at this point in the history
  • Loading branch information
esarbanis committed Mar 6, 2024
1 parent 590b6f0 commit 750fc1a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tools/version.sh
@@ -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

0 comments on commit 750fc1a

Please sign in to comment.