Skip to content
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
50 changes: 50 additions & 0 deletions intelligence/dev/bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -e
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../

# Check if exactly one argument is provided and is one of the allowed values.
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [patch|minor|major]"
exit 1
fi

version_type="$1"

if [[ "$version_type" != "patch" && "$version_type" != "minor" && "$version_type" != "major" ]]; then
echo "Invalid version type: $version_type"
echo "Usage: $0 [patch|minor|major]"
exit 1
fi

# Bump version in the ts package using pnpm
cd ts

# Get the old version from package.json
old_version=$(node -p "require('./package.json').version")
echo "Old version: $old_version"

pnpm version "$version_type"

# Get the new version from package.json
new_version=$(node -p "require('./package.json').version")
echo "New version: $new_version"

# Update the version in src/constants.ts
sed -i.bak "s/export const VERSION = '.*';/export const VERSION = '$new_version';/g" src/constants.ts

# Update the version in src/flowerintelligence.test.ts
sed -i.bak "s/VERSION: '.*',/VERSION: '$new_version',/g" src/flowerintelligence.test.ts

# Remove the temporary backup files created by sed
rm src/constants.ts.bak src/flowerintelligence.test.ts.bak

# Update all examples/*/package.json files to set "@flwr/flwr" to the old version.
for pkg in examples/*/package.json; do
echo "Updating $pkg with version ^$old_version"
sed -i.bak "s/\"@flwr\/flwr\": \"\^[0-9]*\.[0-9]*\.[0-9]*\",/\"@flwr\/flwr\": \"^$old_version\",/g" "$pkg"
rm "$pkg.bak"
done

cd ..

echo "Version updated successfully!"