Files
Palmr/infra/update-versions.sh
Daniel Luiz Alves 69b808ef5e feat: add version update functionality and update package versions
- Introduced a new Makefile target `update-version` to streamline version updates across all package.json files.
- Added a script `update-versions.sh` to automate the version number update process.
- Updated package versions in `apps/docs`, `apps/server`, and `apps/web` to `3.1-beta` for consistency.
- Enhanced the build process to include version updates before building the Docker image.
2025-06-27 16:57:53 -03:00

44 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Script to update version numbers in all package.json files
# Usage: ./update-versions.sh <version>
VERSION=$1
if [ -z "$VERSION" ]; then
echo "❌ Error: Version parameter is required"
echo "Usage: $0 <version>"
echo "Example: $0 v3.0.0"
exit 1
fi
echo "🔄 Updating version to $VERSION in all package.json files..."
# Function to update version in package.json
update_package_json() {
local file=$1
local app_name=$2
if [ -f "$file" ]; then
# Use sed to update the version line
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS requires different sed syntax
sed -i '' "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$file"
else
# Linux sed syntax
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$file"
fi
echo "✅ Updated $app_name: $file"
else
echo "❌ Warning: $file not found"
fi
}
# Update all three package.json files
update_package_json "apps/web/package.json" "Web App"
update_package_json "apps/docs/package.json" "Documentation"
update_package_json "apps/server/package.json" "API Server"
echo "🎉 Version update completed!"
echo "📦 All package.json files now have version: $VERSION"