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(repo): add command line tool to update versions in all packages #1872

Merged
merged 1 commit into from
Mar 6, 2024
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
43 changes: 43 additions & 0 deletions tools/version.sh
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
Loading